php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #741 Adding 86400 seconds to Oct. 25 1998 gives wrong answer
Submitted: 1998-09-13 01:10 UTC Modified: 1998-09-13 01:45 UTC
From: research4 at snowcrest dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.3 OS: Win95
Private report: No CVE-ID: None
 [1998-09-13 01:10 UTC] research4 at snowcrest dot net
<html>

<body>

Using extension=calendar.dll in php3.ini...<p>

<?php

$one = mktime(0,0,0,10,25,1998); // Timestamp for Oct. 25, 1998 at 00:00:00
$done = date("m/d/Y H:i:m",$one); // Date conversion for fun
echo "$done<br>\n";
$two = mktime(0,0,0,10,26,1998); // Timestamp for Oct. 26, 1998 at 00:00:00
$dtwo = date("m/d/Y H:i:m",$two); // Date conversion for fun
echo "$dtwo<br>\n";

$three = $one+86400; // Add a day's worth of seconds to Oct. 25
echo "Does $two = $three?<br>"; // Still on Oct. 25!
$dthree = date("m/d/Y H:i:m",$three); // Date conversion for more fun
echo "$dthree<br>\n";
echo "What's the difference? ";
echo (int)$three-(int)$two;
echo "<p>\n";

$four = $two+86400; //Add a day's worth of seconds to Oct. 26
$dfour = date("m/d/Y H:i:m",$four);
echo "$dfour<br>\n";

?>
</body>
</html>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-09-13 01:45 UTC] rasmus
This is the proper behaviour.  October 25th, 1998 happens to be the day that daylight savings time kicks in.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC