public static function IsValid($p_value)
{
$p_value = trim($p_value);
// curdate() is an value which have to be computed
if (preg_match('/now\\(\\)|curdate\\(\\)|curtime\\(\\)/i', $p_value)) {
return true;
}
if (preg_match('/^[\\d]{4,4}-[\\d]{1,2}-[\\d]{1,2}$/', $p_value) == 0) {
return false;
}
list($year, $month, $monthDay) = preg_split('/-/', $p_value);
if ($month < 1 || $month > 12) {
return false;
}
$lastMonthDay = strftime('%d', mktime(0, 0, 0, $month + 1, 0, $year));
if ($monthDay < 1 || $monthDay > $lastMonthDay) {
return false;
}
return true;
}