Re: Bug #12378: checkdate returns TRUE on false date
| From: | J Smith | Date: | Wed, 25 Jul 2001 20:45:09 +0000 |
| Subject: | Re: Bug #12378: checkdate returns TRUE on false date | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-60997@lists.php.net to get a copy of this message | ||
webmaster@telescopium.dk wrote:
> From: webmaster@telescopium.dk
> Operating system: linux
> PHP version: 4.0.6
> PHP Bug Type: Date/time related
> Bug description: checkdate returns TRUE on false date
>
> The checkdate doesn't validate correcly on all dates.
>
> checkdate(2,29,2000); returns true even thoug the year 2000 was not a
> leapyear.
Actually, 2000 was a leap year.
If the year is not divisible by 100 but is divisible by 4, it is a leap
year. (1900 is therefore not a leap year.)
If the year is divisible by 100 and is divisible by 400, it is a leap year.
(2000 is therefore a leap year.)
There is a good FAQ on this at
http://world.std.com/~dpbsmith/leapyearfaq.txt.
There's also a good node on this stuff at http://www.everything2.com.
J