|
Posted by Michael Fesser on 02/26/07 22:14
..oO(Rik)
>Thank you for this wonderfull example against using strtotime(). Never
>liked the unpredictability of this function :-)
It's all documented:
| The function expects to be given a string containing a US English date
| format [...]
http://www.php.net/manual/en/function.strtotime.php
| For numeric months, the ISO 8601 format `year-month-day' is allowed
| [...] The construct `month/day/year', popular in the United States, is
| accepted. Also `month/day', omitting the year.
http://www.gnu.org/software/tar/manual/html_node/tar_111.html#SEC111
There's no word about locales, so you can't expect strtotime() to
recognize every localized date format.
In my projects I use my own date parser class, which uses some regular
expressions to recognize the most common formats (especially the German
dd.mm.yy[yy], which is what I usually need). If the matching fails, I
call strtotime() just as a fallback.
Micha
Navigation:
[Reply to this message]
|