"Jasper Bryant-Greene" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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;
> }
> ?>

I'd shorten it up even more:

<?
$daysinyear = 365 + date("L", strtotime("jan 1 " . $year));
?>

Brian

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to