note 42349 added to function.mktime

From: Date: Thu, 13 May 2004 00:42:43 +0000
Subject: note 42349 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-69540@lists.php.net to get a copy of this message
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; } ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42349 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42349&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42349&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69540) next »