php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42155 checkdate() incorrect behaviour for leap year
Submitted: 2007-07-31 09:40 UTC Modified: 2007-07-31 11:01 UTC
From: ahlers_wim at hotmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.3 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
3 + 38 = ?
Subscribe to this entry?

 
 [2007-07-31 09:40 UTC] ahlers_wim at hotmail dot com
Description:
------------
Dates divisible by 400 should not be a leap year. (for milleniums to come.)
checkdate() should be modified to incorporate this date related cycle.

Reproduce code:
---------------
checkdate(2, 29, 2000);

Expected result:
----------------
FALSE

Actual result:
--------------
TRUE

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-31 11:01 UTC] scottmac@php.net
Years divisible by 400 *are* leap years,
Years divisible by 100 are not leap years
Years divisible by 4 *are* leap years

php -r "var_dump(checkdate(2, 29, 2000));"
bool(true)

php -r "var_dump(checkdate(2, 29, 2100));"
bool(false)

php -r "var_dump(checkdate(2, 29, 2200));"
bool(false)

php -r "var_dump(checkdate(2, 29, 2300));"
bool(false)

php -r "var_dump(checkdate(2, 29, 2400));"
bool(true)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 00:01:28 2024 UTC