I found a php function checkdate() , but strangely enough it only seems to accept data in format of int $month , int $day , int $year. However I am passing the date as a string (example "2012-06-13") so I came up with this workaround, because I would only allow date entered in such format. Unfortunately I am feeling this is both insecure and not a nice approach to the problem:
function CheckAdditional($value)
{
$data = explode("-", $value);
return checkdate($data[1], $data[2], $data[0]);
}
Question: is there a better way to check whether the date is valid?