本文整理汇总了PHP中Zend_Date::getTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Date::getTimezone方法的具体用法?PHP Zend_Date::getTimezone怎么用?PHP Zend_Date::getTimezone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Date
的用法示例。
在下文中一共展示了Zend_Date::getTimezone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTimezone
/**
* Test for Timezone
*/
public function testTimezone()
{
$locale = new Zend_Locale('de_AT');
$date = new Zend_Date(1010101010, $locale);
$date->setTimezone(date_default_timezone_get());
$result = $date->getTimezone();
$this->assertSame($result, 'Indian/Maldives');
try {
$result = $date->setTimezone('unknown');
// if function timezone_identifiers_list is not avaiable false should be returned
$this->assertSame($result, false);
} catch (Zend_Date_Exception $e) {
// success
}
$result = $date->getTimezone();
$this->assertSame($result, 'Indian/Maldives');
$result = $date->setTimezone('America/Chicago');
$this->assertSame($result, true);
$result = $date->getTimezone();
$this->assertSame($result, 'America/Chicago');
}
示例2: testZF4867
/**
* Test for ZF-4867
*/
public function testZF4867()
{
date_default_timezone_set('America/New_York');
$date1 = new Zend_Date('2006-01-01 01:00:00 Europe/Paris', Zend_Date::ISO_8601);
$this->assertEquals('Europe/Paris', $date1->getTimezone());
}
示例3: testTimezone
/**
* Test for Timezone
*/
public function testTimezone()
{
$locale = new Zend_Locale('de_AT');
$date = new Zend_Date(1010101010, $locale);
$date->setTimezone(date_default_timezone_get());
$result = $date->getTimezone();
$this->assertSame($result, 'Europe/Vienna');
$result = $date->setTimezone('unknown');
$this->assertSame($result, false);
$result = $date->getTimezone();
$this->assertSame($result, 'Europe/Vienna');
$result = $date->setTimezone('America/Chicago');
$this->assertSame($result, true);
$result = $date->getTimezone();
$this->assertSame($result, 'America/Chicago');
}