本文整理匯總了PHP中core_date::get_localised_timezone方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_date::get_localised_timezone方法的具體用法?PHP core_date::get_localised_timezone怎麽用?PHP core_date::get_localised_timezone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core_date
的用法示例。
在下文中一共展示了core_date::get_localised_timezone方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: usertimezone
/**
* Returns a string that prints the user's timezone
*
* @package core
* @category time
* @param float|int|string $timezone user timezone
* @return string
*/
function usertimezone($timezone = 99)
{
$tz = core_date::get_user_timezone($timezone);
return core_date::get_localised_timezone($tz);
}
示例2: test_get_localised_timezone
public function test_get_localised_timezone()
{
$this->resetAfterTest();
$this->setTimezone('Pacific/Auckland', 'Pacific/Auckland');
$result = core_date::get_localised_timezone('Pacific/Auckland');
$this->assertSame('Pacific/Auckland', $result);
$result = core_date::get_localised_timezone('99');
$this->assertSame('Server timezone (Pacific/Auckland)', $result);
$result = core_date::get_localised_timezone(99);
$this->assertSame('Server timezone (Pacific/Auckland)', $result);
$result = core_date::get_localised_timezone('Etc/GMT-1');
$this->assertSame('UTC+1', $result);
$result = core_date::get_localised_timezone('Etc/GMT+2');
$this->assertSame('UTC-2', $result);
$result = core_date::get_localised_timezone('GMT');
$this->assertSame('UTC', $result);
$result = core_date::get_localised_timezone('Etc/GMT');
$this->assertSame('UTC', $result);
}