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

From: Date: Sun, 29 Oct 2000 14:00:54 +0000
Subject: Re: PHP 4.0 Bug #7518: Rounding problems with mktime() or date()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-36344@lists.php.net to get a copy of this message
At 12:56 29-10-00, sascha@mantscheff.net wrote:
From:             sascha@mantscheff.net
Operating system: SuSE Linux 6.4
PHP version:      4.0.1pl2
PHP Bug Type:     Date/time related
Bug description: Rounding problems with mktime() or date() <?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.
My guess is that it's due to daylight saving issues. Any chance there's a switch between standard time to daylight time (or the other way around) on this date?
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.
I don't think that's related, if it is, I haven't understood your bug report. Numbers with leading zeros are treated as octals. Since there's no '8' digit in the octal base, '08' ends up being treated as 0. It's the expected behavior. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.dev (#36344) next »