Bug #1896: date('t',..) function does not return 29 as last day for Feb 2000

From: Date: Tue, 27 Jul 1999 18:58:33 +0000
Subject: Bug #1896: date('t',..) function does not return 29 as last day for Feb 2000
Groups: php.dev 
Request: Send a blank email to php-dev+get-9243@lists.php.net to get a copy of this message
From: atanas@intransco.com Operating system: Linux PHP version: 3.0.11 PHP Bug Type: Misbehaving function Bug description: date('t',..) function does not return 29 as last day for Feb 2000 $last_day = date ('t', mktime(1,1,1,$month,1,$year)); if (($year == '2000') and ($month == '02')) {$last_day = 29;} /* for building a calendar, I needed a loop from 1 to last_day_in_month checkdate(..) returned correctly 29 for Feb 2000 as last valid day getting straight at the last day using date('t',...) - the script above returns 28 days Of course, the "fix" is easy, but better fix the function internally: Any year evenly divisible by 400 is a leap year! */

« previous php.dev (#9243) next »