php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26917 Incorrect date returned by date()
Submitted: 2004-01-15 06:25 UTC Modified: 2004-01-15 06:33 UTC
From: paul at mileham dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.4 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: paul at mileham dot net
New email:
PHP Version: OS:

 

 [2004-01-15 06:25 UTC] paul at mileham dot net
Description:
------------
date() returns Saturday 27th March 2004 instead of Sunday 28th March 2004. mktime is OK.We have a diary with two consecutive Saturdays - hoorah!

Reproduce code:
---------------
// this proves there's a bug in php dates!!
for($i=1;$i<32;$i++) {
$monnum=3;
$year=2004;
$date2= date('D jS F Y',mktime(0,0,0,$monnum,$i,$year));
$d3=mktime(0,0,0,$monnum,$i,$year);
echo "<br>".$date2;
echo $d3;
}

Expected result:
----------------
Each date correct

Actual result:
--------------
Two Saturdays and no Sunday

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-15 06:33 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.

DST
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 02:01:29 2024 UTC