[PHP-NOTES] note 130396 added to function.checkdate

[email protected] ("Anonymous") Sun, 29 Jun 2025 15:01:21 +0000 (UTC)
Newsgroups php.notes
Message-ID <[email protected]>
Function above from gladic returns bad result with format "Y-m" when month  is february and the year is non bissextile.

function validateDate($date, $format = 'Y-m-d H:i:s')
{
    $d = DateTime::createFromFormat($format, $date);
    return $d && $d->format($format) == $date;
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2a01:cb08:9009:9d00:60a2:b536:8313:bc80)
----
Manual Page -- https://php.net/manual/en/function.checkdate.php
Edit        -- https://main.php.net/note/edit/130396
Del: integrated  -- https://main.php.net/note/delete/130396/integrated
Del: useless     -- https://main.php.net/note/delete/130396/useless
Del: bad code    -- https://main.php.net/note/delete/130396/bad+code
Del: spam        -- https://main.php.net/note/delete/130396/spam
Del: non-english -- https://main.php.net/note/delete/130396/non-english
Del: in docs     -- https://main.php.net/note/delete/130396/in+docs
Del: other reasons-- https://main.php.net/note/delete/130396
Reject      -- https://main.php.net/note/reject/130396
Search      -- https://main.php.net/manage/user-notes.php