Re: mktime

From: Date: Tue, 13 Sep 2005 03:25:17 +0000
Subject: Re: mktime
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-222238@lists.php.net to get a copy of this message
On Tue, 2005-09-13 at 11:13 +1200, Jasper Bryant-Greene wrote: > Dan Brow wrote: > > A little confused with mktime, I'm trying to get how many days are in a > > year. > > How about doing it differently. I'd tackle this problem like this: > > <?php > $year = '2005'; > $time = strtotime("1 January $year"); > $isLeapYear = date('L', $time); > > if($isLeapYear == '1') { > $days = 366; > } else { > $days = 365; > } > ?> Thanks.

« previous php.general (#222238) next »