Edit report at http://bugs.php.net/bug.php?id=51457&edit=1
ID: 51457 Updated by: ahar...@php.net Reported by: mobile at bingeman dot org dot uk Summary: gmdate interpretation -Status: Open +Status: Bogus Type: Bug Package: Date/time related Operating System: linux PHP Version: 5.3.2 New Comment: Since you're in the UK, and your computer/server is hence probably set to Europe/London as a time zone, this is likely due to daylight saving time. For example, with 2010-04-01, strtotime() will be returning 12:00 am on the 1st of April in your local time zone, but as the UK is now GMT+1, gmdate() interprets that as being 11:00 pm on the previous day (which it is in GMT), hence you get the result of 31-03-2010. Previous Comments: ------------------------------------------------------------------------ [2010-04-01 22:16:14] mobile at bingeman dot org dot uk 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 this bug report at http://bugs.php.net/bug.php?id=51457&edit=1