note 18381 deleted from ref.calendar by felipe

From: Date: Fri, 04 Jan 2008 01:37:52 +0000
Subject: note 18381 deleted from ref.calendar by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134742@lists.php.net to get a copy of this message
Note Submitter: kmcm at bigfoot dot com ---- if, like me, you don't have a PHP build that includes the cal functions, you may want to use this function for sorting out leap year. function days_in_feb($year){ //$year must be YYYY //[gregorian] leap year math : if ($year < 0) $year++; $year += 4800; if ( ($year % 4) == 0) { if (($year % 100) == 0) { if (($year % 400) == 0) { return(29); } else { return(28); } } else { return(29); } } else { return(28); } } of course the next leap year isn't until the end of the century but this makes for timeless code I guess ...or if you are using 2000 in your dates or are going far back in time, etc, it is necessary.

« previous php.notes (#134742) next »