Re: oops .. problem with date()

From: Date: Mon, 07 Jun 1999 18:12:51 +0000
Subject: Re: oops .. problem with date()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-6662@lists.php.net to get a copy of this message
On Mon, 7 Jun 1999, Colin Viebrock wrote: > Try the following with 3.0.9: > > <? > echo date("t", mktime(0,0,0,2,1,2000)); > ?> > > It should output 29, but outputs 28 instead. Obviously, I goofed > somewhere when I moved isleap() outside of all the functions. > > I'm really really sorry, but it means 3.0.9 is busted. If it helps, only 't' parameter to date is busted. Test: <? echo date("t", mktime(0,0,0,2,29,2000)) . " "; if (checkdate(2,29,2000)) { echo "OK\n"; } else { echo "Bad date!\n"; } ?> > (FWIW, I know that that is what the problem is, because I added > some more date stuff to the CVS and it works fine, except for > the leap year calculation which is always 0). > > Can someone give datetime.c a look over and see what I did wrong. man gmtime: tm_year The number of years since 1900. So, isleap was testing the wrong year... :( Jouni Ahto

« previous php.dev (#6662) next »