note 96821 added to function.strtotime

From: Date: Wed, 17 Mar 2010 14:29:35 +0000
Subject: note 96821 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-167136@lists.php.net to get a copy of this message
I'm running PHP 5.2.11 and I've run into issues with strtotime() interpreting MM-DD-YYYY formatted dates differently than expected. Unless the day is above 12, it will assume that the format of the date is DD-MM-YYYY. The easiest way to get around this is to use slashes instead of hyphens. <?php echo date('Y-m-d', strtotime('01-03-2010')); // outputs 2010-03-01 echo date('Y-m-d', strtotime('01/03/2010')); // outputs 2010-01-03 ?> This seems like it may be a bug since the documentation states that it accepts a "US English date format" and DD-MM-YYYY is not the standard US date format. http://en.wikipedia.org/wiki/Calendar_date ---- Server IP: 69.147.83.197 Probable Submitter: 71.123.219.242 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/96821 Del: integrated -- https://master.php.net/note/delete/96821/integrated Del: useless -- https://master.php.net/note/delete/96821/useless Del: bad code -- https://master.php.net/note/delete/96821/bad+code Del: spam -- https://master.php.net/note/delete/96821/spam Del: non-english -- https://master.php.net/note/delete/96821/non-english Del: in docs -- https://master.php.net/note/delete/96821/in+docs Del: other reasons-- https://master.php.net/note/delete/96821 Reject -- https://master.php.net/note/reject/96821 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167136) next »