Bug #54493 [Opn->Bgs]: Dates stored as yyyy-00-00 in MySQL are returned as the previous year
| From: | derick@php.net | Date: | Fri, 08 Apr 2011 13:05:11 +0000 |
| Subject: | Bug #54493 [Opn->Bgs]: Dates stored as yyyy-00-00 in MySQL are returned as the previous year | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160030@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54493&edit=1
ID: 54493
Updated by: derick@php.net
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: Open
+Status: Bogus
Type: Bug
Package: Date/time related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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