本文整理匯總了PHP中Zend_Locale_Format::isDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Locale_Format::isDate方法的具體用法?PHP Zend_Locale_Format::isDate怎麽用?PHP Zend_Locale_Format::isDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Locale_Format
的用法示例。
在下文中一共展示了Zend_Locale_Format::isDate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testIsDate
/**
* test isDate
* expected boolean
*/
public function testIsDate()
{
$this->assertTrue(Zend_Locale_Format::isDate('13.Nov.2006', array('locale' => 'de_AT')), "true expected");
$this->assertFalse(Zend_Locale_Format::isDate('13.XXX.2006', array('locale' => 'ar_EG')), "false expected");
$this->assertFalse(Zend_Locale_Format::isDate('nodate'), "false expected");
$this->assertFalse(Zend_Locale_Format::isDate('20.01.2006', array('date_format' => 'M-d-y')), "false expected");
$this->assertTrue(Zend_Locale_Format::isDate('20.01.2006', array('date_format' => 'd-M-y')), "true expected");
}
示例2: testIsDateFailed
/**
* test isDate
* expected false
*/
public function testIsDateFailed()
{
$value = Zend_Locale_Format::isDate('nodate');
$this->assertFalse($value, "false expected");
}
示例3: isValid
/**
* Defined by Zend_Validate_Interface
*
* Returns true if and only if $value is a valid date
*
* @param mixed $value
* @return boolean
*/
public function isValid($value)
{
$this->_messages = array();
do {
if (is_numeric($value)) {
break;
}
/**
* @see Zend_Locale_Format
*/
require_once 'Zend/Locale/Format.php';
if (Zend_Locale_Format::isDate($value, $this->_format, $this->_locale)) {
break;
}
$this->_messages[] = "'{$value}' does not appear to be a valid date";
return false;
} while (false);
return true;
}