note 92531 added to function.date
| From: | (MangeshSangapu) | Date: | Tue, 28 Jul 2009 16:31:43 +0000 |
| Subject: | note 92531 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158830@lists.php.net to get a copy of this message | ||
(Referring to the leap year posts)
Not every year that is divisible by 4 is a leap year. There are other conditions. Here's the
complete list:
1. Every year that is evenly divisible by four is a leap year;
2. of those years, if it can be evenly divided by 100, it is NOT a leap year, unless
3. the year is evenly divisible by 400. Then it is a leap year.
<?php
function is_leapyear($year) {
if ( ($year%4) != 0 )
{ return false; }
if ( ($year%100)==0 )
{
if ( ($year%400) == 0 )
{ return true; }
else
{ return false; }
}
else
{ return true; }
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 129.237.188.23
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/92531
Del: integrated -- https://master.php.net/note/delete/92531/integrated
Del: useless -- https://master.php.net/note/delete/92531/useless
Del: bad code -- https://master.php.net/note/delete/92531/bad+code
Del: spam -- https://master.php.net/note/delete/92531/spam
Del: non-english -- https://master.php.net/note/delete/92531/non-english
Del: in docs -- https://master.php.net/note/delete/92531/in+docs
Del: other reasons-- https://master.php.net/note/delete/92531
Reject -- https://master.php.net/note/reject/92531
Search -- https://master.php.net/manage/user-notes.php