ID:               49011
 Updated by:       der...@php.net
 Reported By:      soapergem at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Windows
 PHP Version:      5.3.0
 New Comment:

This is a design decision. If you use / (the prefered US way), it uses
MM/DD/YYYY and if you use - (the preferred UK way), it uses DD-MM-YYYY.
If you want to parse the MM-DD-YYYY format, have a look at
http://uk2.php.net/manual/en/datetime.createfromformat.php (beware
though, the format it uses is only *resembling* that what date()
supports. The docs are vague here).


Previous Comments:
------------------------------------------------------------------------

[2009-07-21 21:06:22] soapergem at gmail dot com

Description:
------------
An extremely common date format in the USA is middle endian, which is
often expressed in one of two ways. Today's date (July 21, 2009) could
be expressed as either of the following:

1. 07/21/2009
2. 07-21-2009

Currently, if the first version (1) is passed into strtotime(), it
successfully parses the date. However, the second version (2) returns
FALSE.

Reproduce code:
---------------
<?php

var_dump(strtotime('07/21/2009')); // good
var_dump(strtotime('07-21-2009')); // bad

?>

Expected result:
----------------
int(1248152400)
int(1248152400)

Actual result:
--------------
int(1248152400)
bool(false)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49011&edit=1

Reply via email to