php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27970 mktime() gives bad timestamp in april.
Submitted: 2004-04-12 23:32 UTC Modified: 2004-04-13 03:12 UTC
From: crestien at bellsouth dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.5 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2004-04-12 23:32 UTC] crestien at bellsouth dot net
Description:
------------
This error only came about in April.  I've had it on my intranet for about a year now..  and all of a sudden I have two April 3rds on my Time Clock and it's consistent on matter what year it's on.  I cleared it up by just adding an hour to the mktime() to force it further into the day.

This is a very normal setup of PHP.  It's the stable release of 4.3.5 and it's running IIS 5 as cgi per the auto installer

The only changes in the php.ini is my doc_root to a separate drive and my extensions directory to c:\PHP.

This also did it on my home computer running 4.3.5 as a module on Apache 1.3.29 on Windows XP.

Reproduce code:
---------------
//Bad Code
for($i=1; $i<31; $i++) {
	$timestamp = mktime(0,0,0,4,$i,2004);
        echo date("F j", $timestamp)." - ".$timestamp."<br>";
}

//Jimmy Rigged Code - **Added 1 hour**
for($i=1; $i<31; $i++) {
	$timestamp = mktime(1,0,0,4,$i,2004);
        echo date("F j", $timestamp)." - ".$timestamp."<br>";
}

Expected result:
----------------
April 1 - 1080802800
April 2 - 1080889200
April 3 - 1080975600
April 4 - 1081058400
April 5 - 1081144800
April 6 - 1081231200
.
.
etc

Actual result:
--------------
April 1 - 1080799200
April 2 - 1080885600
April 3 - 1080972000
April 3 - 1081054800
April 5 - 1081141200
April 6 - 1081227600
.
.
etc

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 03:12 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

(And this is also fixed)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 19:01:32 2024 UTC