Regular expression to validate yyyy-mm-dd dates
if(!preg_match('/^(\d{4})-((0[1-9])|(1[0-2]))-(0[1-9]|[12][0-9]|3[01])$/', $date)) {
throw new sfException('Date must be in yyyy-mm-dd format');
}
if(!preg_match('/^(\d{4})-((0[1-9])|(1[0-2]))-(0[1-9]|[12][0-9]|3[01])$/', $date)) {
throw new sfException('Date must be in yyyy-mm-dd format');
}