本文整理汇总了PHP中Zend_Locale_Format::checkDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale_Format::checkDateFormat方法的具体用法?PHP Zend_Locale_Format::checkDateFormat怎么用?PHP Zend_Locale_Format::checkDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Locale_Format
的用法示例。
在下文中一共展示了Zend_Locale_Format::checkDateFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDate
public static function checkDate($date, $format = '')
{
if (empty($format)) {
if (Zend_Registry::isRegistered('date_format')) {
$format = Zend_Registry::get('date_format');
} else {
$format = self::MYSQL_DATE_FORMAT;
}
}
return Zend_Locale_Format::checkDateFormat($date, array('date_format' => $format));
}
示例2: filter
/**
* Defined by Zend_Filter_Interface
*
* Normalizes the given input
*
* @param string $value Value to normalized
* @return string|array The normalized value
*/
public function filter($value)
{
if (Zend_Locale_Format::isNumber($value, $this->_options)) {
return Zend_Locale_Format::getNumber($value, $this->_options);
} else {
if ($this->_options['date_format'] === null && strpos($value, ':') !== false) {
// Special case, no date format specified, detect time input
return Zend_Locale_Format::getTime($value, $this->_options);
} else {
if (Zend_Locale_Format::checkDateFormat($value, $this->_options)) {
// Detect date or time input
return Zend_Locale_Format::getDate($value, $this->_options);
}
}
}
return $value;
}
示例3: testCheckTime
/**
* test checkDateFormat -> time
* expected boolean
*/
public function testCheckTime()
{
$this->assertTrue( Zend_Locale_Format::checkDateFormat('13:10:55', array('date_format' => 'HH:mm:ss', 'locale' => 'de_AT')));
$this->assertTrue( Zend_Locale_Format::checkDateFormat('11:10:55 am', array('date_format' => 'HH:mm:ss', 'locale' => 'ar_EG')));
$this->assertFalse(Zend_Locale_Format::checkDateFormat('notime'));
$this->assertFalse(Zend_Locale_Format::checkDateFormat('13:10', array('date_format' => 'HH:mm:ss', 'locale' => 'de_AT')));
$this->assertFalse(Zend_Locale_Format::checkDateFormat('13', array('date_format' => 'HH:mm', 'locale' => 'de_AT')));
$this->assertFalse(Zend_Locale_Format::checkDateFormat('00:13', array('date_format' => 'ss:mm:HH', 'locale' => 'de_AT')));
}
示例4: testCheckDateFormatDoesNotEmitNoticeWhenNoOptionsAreNotProvided
/**
* @group ZF-11837
*/
public function testCheckDateFormatDoesNotEmitNoticeWhenNoOptionsAreNotProvided()
{
try {
setlocale(LC_ALL, 'en_US');
// test setup
Zend_Locale_Format::setOptions(array('date_format' => 'yyyy-MM-dd'));
$this->assertTrue(Zend_Locale_Format::checkDateFormat('2011-10-21', array()));
} catch (PHPUnit_Framework_Error_Notice $ex) {
$this->fail('Zend_Locale_Format::checkDateFormat emitted unexpected E_NOTICE');
}
}
示例5: testCheckTime
/**
* test checkDateFormat -> time
* expected boolean
*/
public function testCheckTime()
{
$this->assertTrue(Zend_Locale_Format::checkDateFormat('13:10:55', array('date_format' => 'HH:mm:ss', 'locale' => 'de_AT')), "true expected");
$this->assertTrue(Zend_Locale_Format::checkDateFormat('11:10:55 am', array('date_format' => 'HH:mm:ss', 'locale' => 'ar_EG')), "true expected");
$this->assertFalse(Zend_Locale_Format::checkDateFormat('notime'), "false expected");
}