_messages = array(); $valueString = (string) $value; if (!preg_match('/\d{4}-\d{2}-\d{2}/', $valueString)) { $this->_messages[] = "'$valueString' is not of the format YYYY-MM-DD"; return false; } list($year, $month, $day) = sscanf($valueString, '%d-%d-%d'); if (!checkdate($month, $day, $year)) { $this->_messages[] = "'$valueString' does not appear to be a valid date"; return false; } return true; } /** * Defined by Zend_Validate_Interface * * Returns array of validation failure messages * * @return array */ public function getMessages() { return $this->_messages; } }