php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34760 mktime() returns wrong timestamp for some spezific date
Submitted: 2005-10-06 14:58 UTC Modified: 2005-10-06 15:05 UTC
From: csg at diatom dot de Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.4.0 OS: Linux (SuSE 9.2 / 7.3)
Private report: No CVE-ID: None
 [2005-10-06 14:58 UTC] csg at diatom dot de
Description:
------------
For some dates, especially "Oct-08-2005", mktimes does return
a wrong timestamp as result (here: "Sep-30-2005").
You can call the example script at URL:
http://www.kunden-diatom.de/phpBug_mktime.php



Reproduce code:
---------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <title>Bug in mktime()?</title>
</head>
<body>
<h1>Ist das ein Bug in mktime() ?!</h1>
<?php
echo "<p>Noch richtig: date(\"M-d-Y\", mktime(15,0,0,10,07,2005)): " . date("M-d-Y", mktime(15,0,0,10,07,2005)) . " (Unix-Timestamp: " . mktime(15,0,0,10,07,2005) . ")</p>\n";
echo "<p>Leider falsch: date(\"M-d-Y\", mktime(15,0,0,10,08,2005)): " . date("M-d-Y", mktime(15,0,0,10,08,2005)) . " (Unix-Timestamp: " . mktime(15,0,0,10,08,2005) . ")</p>\n";
?>
</body>
</html>


Expected result:
----------------
Ist das ein Bug in mktime() ?!

Noch richtig: date("M-d-Y", mktime(15,0,0,10,07,2005)): Oct-07-2005 (Unix-Timestamp: 1128690000)

Leider falsch: date("M-d-Y", mktime(15,0,0,10,08,2005)): Oct-08-2005 (Unix-Timestamp: <some value bigger than 1128690000>)


Actual result:
--------------
Ist das ein Bug in mktime() ?!

Noch richtig: date("M-d-Y", mktime(15,0,0,10,07,2005)): Oct-07-2005 (Unix-Timestamp: 1128690000)

Leider falsch: date("M-d-Y", mktime(15,0,0,10,08,2005)): Sep-30-2005 (Unix-Timestamp: 1128085200)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-06 15:04 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

No bug here, you're using octal numbers (07 -> 7 but 08 doesn't exist).
 [2005-10-06 15:05 UTC] derick@php.net
Also, file your bugs in english only without all the extra HTML the next time please, just:

echo date("M-d-Y", mktime(15,0,0,10,08,2005));

would have done it.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 07:00:01 2026 UTC