You are here: Re: [PHP] mktime « PHP « IT news, forums, messages
Re: [PHP] mktime

Posted by "Brian P. O'Donnell" on 10/21/30 11:26

"Jasper Bryant-Greene" <jasper@bryant-greene.name> wrote in message
news:43260B7E.4030207@bryant-greene.name...
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация