function preveriDatum($string)
{
if (preg_match("^(3)?(?(1)[0-1]|(0)?(?(2)[1-9]|[12][0-9]))\.(0)?(?(3)[1-9]|1[0-2])\.[1-9][0-9]{3}$^", $string))
return true;
else
return false;
}
is valid for 13.01.2010 but not for 13.1.2010. Can i aso make it valid for 13.1.2010?
You could use:
Better is of course to use the DateTime class (http://php.net/manual/en/book.datetime.php).