本文整理匯總了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');
}