php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23361 mktime gives the wrong answer when year ends in 2
Submitted: 2003-04-26 09:38 UTC Modified: 2003-04-28 09:24 UTC
From: mktime_bug at cuntbubble dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.1 OS: FreeBSD 4.6 & 4.7
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: mktime_bug at cuntbubble dot com
New email:
PHP Version: OS:

 

 [2003-04-26 09:38 UTC] mktime_bug at cuntbubble dot com
enterting some values to mktime produces the wrong answer

echo '<?echo mktime (0,0,0,3,31,2002);?>' | php
-3662

echo '<?echo mktime (0,0,0,3,31,2001);?>' | php
985993200

echo '<?echo mktime (0,0,0,3,31,1002);?>' | php
-3662

echo '<?echo mktime (0,0,0,3,31,2);?>' | php
-3662

echo '<?echo mktime (0,0,0,3,32,2);?>' | php
1017615600

I tried it on two machines
both installed today from the FreeBSD Port

I don't have any other versions available to test it


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-26 09:39 UTC] mktime_bug at cuntbubble dot com
(summary field was wrong)
 [2003-04-28 09:23 UTC] sniper@php.net
Must be OS specific as this works fine in Linux.

 [2003-04-28 09:24 UTC] sniper@php.net
Additional note: Works fine with the LEGAL years, 2002 and 2001, those others in your examples are not legal.

 [2004-03-31 06:14 UTC] anselme at netcourrier dot com
Got the same problem on a FreeBSD4.9 with php4.3.5

Wonder if it isnot a problem with the change of hour ?
(which was the 31 of march in 2002 and the 28th of march in 2004)


echo '<?echo mktime (0,0,0,3,28,2004);?>' | php
-7262
 echo '<?echo mktime (1,0,0,3,28,2004);?>' | php
-3662
 echo '<?echo mktime (2,0,0,3,28,2004);?>' | php
-62
 echo '<?echo mktime (3,0,0,3,28,2004);?>' | php
1080435600  //good
 echo '<?echo mktime (0,0,0,3,29,2004);?>' | php
1080511200 //good

??
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 13:01:32 2024 UTC