php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47574 date() function works incorrect :-(
Submitted: 2009-03-05 16:57 UTC Modified: 2009-03-05 17:22 UTC
From: privatevideo at list dot ru Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.9 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: privatevideo at list dot ru
New email:
PHP Version: OS:

 

 [2009-03-05 16:57 UTC] privatevideo at list dot ru
Description:
------------
date() function works incorrect :-(

Reproduce code:
---------------
# check line 179-180, it should add a minute every step

for ($i=0,$d=1224964800;$d<=1225051200;$d+=60,++$i)
	echo "<br>$i -> ".date('Y-m-d H:i:s',$d);


Expected result:
----------------
179 -> 2008-10-26 02:59:00
180 -> 2008-10-26 03:00:00
181 -> 2008-10-26 03:01:00
182 -> 2008-10-26 03:02:00

Actual result:
--------------
179 -> 2008-10-26 02:59:00
180 -> 2008-10-26 02:00:00
181 -> 2008-10-26 02:01:00
182 -> 2008-10-26 02:02:00

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-05 17:22 UTC] mattwil@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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Dec 06 14:00:01 2025 UTC