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

 ID:                 54493
 User updated by:    john at designstage dot co dot uk
 Reported by:        john at designstage dot co dot uk
 Summary:            Dates stored as yyyy-00-00 in MySQL are returned as
                     the previous year
 Status:             Bogus
 Type:               Bug
 Package:            Date/time related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Apologies - didn't realise that the problem reported in 

http://bugs.php.net/bug.php?id=53662 resulted in this as well.


Previous Comments:
------------------------------------------------------------------------
[2011-04-08 15:05:08] der...@php.net

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #53662

------------------------------------------------------------------------
[2011-04-08 13:10:54] john at designstage dot co dot uk

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 this bug report at http://bugs.php.net/bug.php?id=54493&edit=1

Reply via email to