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

From: Date: Mon, 30 Oct 2000 16:04:17 +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-36432@lists.php.net to get a copy of this message
Adam Trachtenberg wrote: > > On Sun, 29 Oct 2000, Zeev Suraski wrote: > > > ><?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? > > This is correct. Relying on the amount of hours in a day to be a constant > is a bad thing to do. :) > So what should a poor boy do to do date arithmetics? Since there are no functions to do calculations on Julian days in PHP, what would you suppose? I fear I will have to rewrite quite some code in which I assumed a constant day length. s. ------------------------------------ Sascha Mantscheff Bruenglinghausen D-51588 Nuembrecht Fon +49-171-620 0380 Fax +49-2291-3841 e-Mail sascha@mantscheff.net ------------------------------------

« previous php.dev (#36432) next »