PHP 4.0 Bug #7518 Updated: Rounding problems with mktime() or date()

From: Date: Sun, 29 Oct 2000 14:03:05 +0000
Subject: PHP 4.0 Bug #7518 Updated: Rounding problems with mktime() or date()
Groups: php.dev 
Request: Send a blank email to php-dev+get-36345@lists.php.net to get a copy of this message
ID: 7518 Updated by: jah Reported By: sascha@mantscheff.net Status: Closed Bug Type: Date/time related Assigned To: Comments: There was switch to daylight saving on your timezone, so the difference between 2000-10-29 00:00:00 and 2000-10-30 00:00:00 is 90000 seconds, not 86400. Always some other time, for example 12:00:00, which will fall on the right date even when there is 23 or 25 hours in day and you go forward in steps of 86400 seconds. In your second example, numbers beginning with a leading zero are *octal* numbers, and 08 is a non-existent octal number. Previous Comments: --------------------------------------------------------------------------- [2000-10-29 05:56:30] sascha@mantscheff.net <?php $DAYS = 3600 * 24; $fdom = mktime( 0, 0, 0, 10, 8, 2000 ); for ($i = 1; $i < 30; $i++) echo date( "d.m.Y", $fdom + ($i - 1) * $DAYS ) . " "; ?> This script should list the day number from October, 08th, through the next 30 days. It repeats the 29th day of October. I don't know why. If the 3rd line is changed to $fdom = mktime( 0, 0, 0, 10, 08, 2000 ); date counting starts on September 30th, so the leading 0 of "08" is misinterpreted as a standalone zero. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7518

« previous php.dev (#36345) next »