|
Posted by Toby Inkster on 01/12/07 10:43
Vincent Delporte wrote:
> But like I said, it doesn't work for me, because the server on which
> the site is hosted assumes dates are mm/dd/yyyy, but we use dd/mm/yyyy
> over here, so strtotime() is wrong.
It does somewhat annoy me that PHP will assume 01/02/03 to be 2 Jan 2003,
when the vast majority of the world's population will take it to be either
1 Feb 2003 or 3 Feb 2001.
India (pop 1100M), Europe (700M), Africa (855M, excluding South Africa),
South America (370M), Pakistan (170M), Russia (145M), Mexico (105M),
Australia (20M) and NZ (5M) all use little-endian DMY dates: that's over
3.5 billion people (63% of the world) using DMY.
China (pop 1300M), Japan (130M), the Koreas (70M), South Africa (50M) and
Nepal (30M) use the big-endian YMD system: that's nearly 1.6 billion
people (25%).
The only significantly populous countries to use MDY regularly are USA
(pop 300M), Philippines (90M) and Canada (30M): less than half a billion
people (6.5%). (And French Canadians often use DMY.)
(If you were wondering what happened to the other 5.5% of the world's
population, they're mostly using the Islamic calendar.)
It's ridiculous that the date formats used by the majority of the world's
people, must be caught as special cases before a date is passed through to
strtotime(). It's not really PHP's fault though -- PHP just follows the
standard GNU "get_date()" function. Still it would be nice if they could
add an extra parameter:
strtotime ( string time [, int now [, int ambiguity]] )
Such that, if the time was ambiguous (12/31/1999 is unambiguously 31 Dec
1999, but 12/1/1999 could be either 1 Dec or 12 Jan) would assume MDY when
ambiguity==0, DMY when ambiguity==1 and YMD when ambiguity==2.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|