From:             
Operating system: Ubuntu 11.10
PHP version:      5.3.10
Package:          PHP options/info functions
Bug Type:         Bug
Bug description:Cannot mix European and 2 digit year

Description:
------------
---
>From manual page: http://www.php.net/function.strtotime
---

Specifying a date of 10-11-77 will epoch, and not create the timestamp for
10-11-1977 as expected, according to the two notes on the strtotime()
function page shown below.
This should really say "whereas if the separator is a dot (.), then the
European d.m.y format is assumed"

    Note:

    If the number of the year is specified in a two digit format, the
values between 00-69 are mapped to 2000-2069 and 70-99 to 1970-1999.


    Note:

    ...whereas if the separator is a dash (-) or a dot (.), then the
European d-m-y format is assumed.


Test script:
---------------
echo date("Y-m-d H:i:s", strtotime("10-11-77 03:12:01")); // unexpected
fail: supposed to be d/m/y with year 77 auto changed to 1977
echo date("Y-m-d H:i:s", strtotime("10.11.77 03:12:01")); // pass: EUR
d/m/y with year 77 auto changed to 1977
echo date("Y-m-d H:i:s", strtotime("10/11/77 03:12:01")); // pass: US
m/d/y
echo date("Y-m-d H:i:s", strtotime("77-11-10 03:12:01")); // pass: ISO 8601
y-m-d
echo date("Y-m-d H:i:s", strtotime("77/11/10 03:12:01")); // expected fail:
US m/d/y data incorrect


Expected result:
----------------
1977-11-10 03:12:01
1977-11-10 03:12:01
1977-10-11 03:12:01
1977-11-10 03:12:01
1970-01-01 00:00:00

Actual result:
--------------
1970-01-01 00:00:00
1977-11-10 03:12:01
1977-10-11 03:12:01
1977-11-10 03:12:01
1970-01-01 00:00:00

-- 
Edit bug report at https://bugs.php.net/bug.php?id=61314&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=61314&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=61314&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=61314&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=61314&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=61314&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=61314&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=61314&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=61314&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=61314&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=61314&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=61314&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=61314&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=61314&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=61314&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=61314&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=61314&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=61314&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=61314&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=61314&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=61314&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=61314&r=mysqlcfg

Reply via email to