在en_US语言环境中使用Zend_Validate_Date验证YYYY-MM-DD格式的字符串

I'm validating a user-entered date string in YYYY-MM-DD format using Zend_Validate::is($value,'Date').

This call creates this hierarchy:

Zend_Validate::is()
Zend_Validate_Date->isValid()
Zend_Date::isDate()
Zend_Locale_Format::getDate()
Zend_Locale_Format::_parseDate() 

Finally, it fails with this exception:

Zend_Locale_Exception: Unable to parse date '2009-09-08' using 'MMM d, y' (M <> y) in /usr/share/php/Zend/Locale/Format.php on line 1001

I'm using en_US as my application locale. How can I configure Zend_Validate to accept this date format? Is it possible to change the locale format of the date, for example?

Try that:

$validator = new Zend_Validate_Date('YYYY-MM-DD');
if($validator->isValid($value))
    // yay

zend_validate_date has a bug , when you specify following yyyy-MM-dd format and if a date string 2011-10-11 12312 is passed on for validation, it returns true instead of false !!