Revision: 6236
Updated Code
at May 11, 2008 05:34 by estebant
Updated Code
function checkDateFormat($date) { //match the format of the date if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/", $date, $parts)) { //check weather the date is valid of not if(checkdate($parts[2],$parts[3],$parts[1])) return true; else return false; } else return false; } echo checkDateFormat("2008-02-29"); //return true echo checkDateFormat("2007-02-29"); //return false
Revision: 6235
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 11, 2008 05:30 by estebant
Initial Code
function checkDateFormat($date) { //match the format of the date if (preg_match ("/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/â€, $date, $parts)) { //check weather the date is valid of not if(checkdate($parts[2],$parts[3],$parts[1])) return true; else return false; } else return false; }
Initial URL
Initial Description
Initial Title
Function to validate date format in PHP
Initial Tags
date
Initial Language
PHP