note 42349 deleted from function.mktime by felipe
| From: | felipe@php.net | Date: | Sun, 06 Jan 2008 12:02:27 +0000 |
| Subject: | note 42349 deleted from function.mktime by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134844@lists.php.net to get a copy of this message | ||
Note Submitter: Dave J.
----
bichinhoverde's my_gmmktime function uses an incomplete definition of leap year. It's not
leap year if the year is divisible by 100 and NOT divisible by 400. E.G. 2000 was a leap year, but
2100 will not be. Trivial, but it should be said.
Thus,
if ( $i % 4 == 0 ) {
$output += 24*60*60;
}
should be:
if ( (($i % 4 == 0) && ($i % 100 != 0))
|| ($i % 400 == 0) ) {
$output += 24*60*60;
}