Bug #741: Adding 86400 seconds to Oct. 25 1998 gives wrong answer
| From: | research4 at snowcrest dot net | Date: | Sun, 13 Sep 1998 05:10:18 +0000 |
| Subject: | Bug #741: Adding 86400 seconds to Oct. 25 1998 gives wrong answer | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1026@lists.php.net to get a copy of this message | ||
From: research4@snowcrest.net
Operating system: Win95
PHP version: 3.0.3
PHP Bug Type: Misbehaving function
Bug description:
<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>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net