Re: strtotime - assumptions about default formatting of dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 24, 2009 at 13:20, Angus Mann <angusmann@xxxxxxxxx> wrote:
> Hi all. I need to allow users to enter dates and times, and for a while now I've been forcing them to use javascript date/time pickers so I can be absolutely sure the formatting is correct.
>
> Some users are requesting to be able to type the entries themselves so I've decided to allow this.
>
> I'm in Australia, and the standard formatting of dates here is DD/MM/YYYY or DD-MM-YYYY
>
> I recognize this is different to what seems to happen in the US, where it is MM/DD/YYYY or MM-DD-YYYY
>
> When I process an entered date using strtotime() it seems to work fine.
>
> But of course I am concerned when dates like January 2 come up.
>
> I find that 2/1/2009 is interpreted as January 2, 2009 on my installation, which is Windows 7 with location set to Australia.
>
> But can I be sure that all installations of PHP, perhaps in different countries and on different operating systems will interpret dates the same?
>
> I can't find much mention of this question online or in the manual.
>
> Any help much appreciated.
> Angus
>

strtotime() interprets dates according to the rules of the current
timezone. The specific rules are outlined in GNU's manual:
http://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html

-- 
Daniel Egeberg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux