php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49379 Strange bug GMT change without any reason
Submitted: 2009-08-27 01:20 UTC Modified: 2009-08-27 09:45 UTC
From: cyberdisyan at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.10 OS: Ubuntu - Linux
Private report: No CVE-ID: None
 [2009-08-27 01:20 UTC] cyberdisyan at gmail dot com
Description:
------------
When trying to use date(), it return sometime a GMT 02:00 and just one line below GMT 01:00  without any reason ! 

Reproduce code:
---------------
echo date("c",(int)1255903200)."<BR>";
echo date("c",(int)1256508000)."<BR>";

Expected result:
----------------
2009-10-19T00:00:00+01:00
2009-10-26T00:00:00+01:00

Actual result:
--------------
2009-10-19T00:00:00+02:00
2009-10-25T23:00:00+01:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-27 09:13 UTC] derick@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

.
 [2009-08-27 09:25 UTC] cyberdisyan at gmail dot com
Dear derick,
Thanks for your prompt reply ... happy that it's not a bug ... but unhappy to change thousands of code line :( 

You can close the ticket :)
 [2009-08-27 09:32 UTC] derick@php.net
No need to change 1000s of lines of code, just tell PHP that you want to use UTC:

date_default_timezone_set( 'UTC' );

 [2009-08-27 09:45 UTC] cyberdisyan at gmail dot com
Thanks again ! 
You just saved my day !!! :))))
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 01 12:00:03 2025 UTC