From:             
Operating system: 
PHP version:      Irrelevant
Package:          Date/time related
Bug Type:         Bug
Bug description:Dates stored as yyyy-00-00 in MySQL are returned as the 
previous year

Description:
------------
---

>From manual page: http://www.php.net/book.datetime

---



If a year is saved as a MySQL date without months or days being set - in
the 

format yyyy-00-00 - when it's returned using DateTime the year before
results. So 

2000-00-00 is returned with the value of the year set to 1999.

Test script:
---------------
<?php  $date = '2000-00-00';

$date = new DateTime($date);

echo $date->format('Y'); ?>

Expected result:
----------------
2000

Actual result:
--------------
1999

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

Reply via email to