From:
Operating system: linux
PHP version: 5.3.2
Package: Date/time related
Bug Type: Bug
Bug description:gmdate interpretation
Description:
------------
Hi all
I must be missing the plot, I have just noticed that when accessing date
information from a MYSQL DB, which has been stored in the format
yyyy-mm-dd, the date is being displayed incorrectly as of 29/03/2010. Any
date displayed using gmdate from and including 29/03/2010 and upto
04/04/2010, possibly further, is being displayed as the stored date LESS 1
day.
Example
DB table shows 2010-03-30
echo gmdate("d-m-Y", strtotime("$test1")); interpretates the same
information as 29-03-2010.
Am I missing the point or is there something wrong?
Regards
Ross
Test script:
---------------
<?
$test26="2010-03-26";
$test27="2010-03-27";
$test28="2010-03-28";
$test29="2010-03-29";
$test30="2010-03-30";
$test31="2010-03-31";
$test32="2010-04-01";
$test33="2010-04-02";
echo gmdate("d-m-Y", strtotime("$test26"))," = $test26<br>";
echo gmdate("d-m-Y", strtotime("$test27"))," = $test27<br>";
echo gmdate("d-m-Y", strtotime("$test28"))," = $test28<br>";
echo gmdate("d-m-Y", strtotime("$test29"))," = $test29<br>";
echo gmdate("d-m-Y", strtotime("$test30"))," = $test30<br>";
echo gmdate("d-m-Y", strtotime("$test31"))," = $test31<br>";
echo gmdate("d-m-Y", strtotime("$test32"))," = $test32<br>";
echo gmdate("d-m-Y", strtotime("$test33"))," = $test33<br>";
?>
Expected result:
----------------
26-03-2010 = 2010-03-26
27-03-2010 = 2010-03-27
28-03-2010 = 2010-03-28
29-03-2010 = 2010-03-29
30-03-2010 = 2010-03-30
31-03-2010 = 2010-03-31
01-03-2010 = 2010-04-01
02-04-2010 = 2010-04-02
Actual result:
--------------
26-03-2010 = 2010-03-26
27-03-2010 = 2010-03-27
28-03-2010 = 2010-03-28
28-03-2010 = 2010-03-29
29-03-2010 = 2010-03-30
30-03-2010 = 2010-03-31
31-03-2010 = 2010-04-01
01-04-2010 = 2010-04-02
--
Edit bug report at http://bugs.php.net/bug.php?id=51457&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51457&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51457&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51457&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51457&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51457&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51457&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51457&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51457&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51457&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51457&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51457&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51457&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51457&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51457&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51457&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51457&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51457&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51457&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51457&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51457&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51457&r=mysqlcfg