On Thu, Dec 24, 2009 at 9:12 AM, tedd <tedd.sperling@xxxxxxxxx> wrote: > At 10:20 PM +1000 12/24/09, Angus Mann 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 > > Angus: > > You are running into a problem that cannot be solved by allowing the user to > do whatever they want. As you realize, if I enter 01-02-09 you don't know if > I mean January 2, 2009 or February 1, 2009 and there is no way to figure out > what I meant. > > The solution is simply to use the html <option> and give the user that way > to enter month and day. > > I would set it to day-month-year and let US visitors live with it for I > personally think that's a better format. > > Cheers and Merry Christmas. > > tedd > > > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I would agree with tedd. Use a JS calendar widget (requires js) or use three select boxes for mm , dd and year -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php