本文整理汇总了PHP中Cake\I18n\Time::listTimezones方法的典型用法代码示例。如果您正苦于以下问题:PHP Time::listTimezones方法的具体用法?PHP Time::listTimezones怎么用?PHP Time::listTimezones使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\I18n\Time
的用法示例。
在下文中一共展示了Time::listTimezones方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testListTimezones
/**
* testListTimezones
*
* @return void
*/
public function testListTimezones()
{
$return = Time::listTimezones();
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertEquals('Bangkok', $return['Asia']['Asia/Bangkok']);
$this->assertTrue(isset($return['America']['America/Argentina/Buenos_Aires']));
$this->assertEquals('Argentina/Buenos_Aires', $return['America']['America/Argentina/Buenos_Aires']);
$this->assertTrue(isset($return['UTC']['UTC']));
$this->assertFalse(isset($return['Cuba']));
$this->assertFalse(isset($return['US']));
$return = Time::listTimezones('#^Asia/#');
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertFalse(isset($return['Pacific']));
$return = Time::listTimezones('#^(America|Pacific)/#', null, false);
$this->assertTrue(isset($return['America/Argentina/Buenos_Aires']));
$this->assertTrue(isset($return['Pacific/Tahiti']));
$return = Time::listTimezones(\DateTimeZone::ASIA);
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertFalse(isset($return['Pacific']));
$return = Time::listTimezones(\DateTimeZone::PER_COUNTRY, 'US', false);
$this->assertTrue(isset($return['Pacific/Honolulu']));
$this->assertFalse(isset($return['Asia/Bangkok']));
}
示例2: testListTimezones
/**
* testListTimezones
*
* @return void
*/
public function testListTimezones()
{
$return = Time::listTimezones();
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertEquals('Bangkok', $return['Asia']['Asia/Bangkok']);
$this->assertTrue(isset($return['America']['America/Argentina/Buenos_Aires']));
$this->assertEquals('Argentina/Buenos_Aires', $return['America']['America/Argentina/Buenos_Aires']);
$this->assertTrue(isset($return['UTC']['UTC']));
$this->assertFalse(isset($return['Cuba']));
$this->assertFalse(isset($return['US']));
$return = Time::listTimezones('#^Asia/#');
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertFalse(isset($return['Pacific']));
$return = Time::listTimezones(null, null, ['abbr' => true]);
$this->assertTrue(isset($return['Asia']['Asia/Jakarta']));
$this->assertEquals('Jakarta - WIB', $return['Asia']['Asia/Jakarta']);
$this->assertEquals('Regina - CST', $return['America']['America/Regina']);
$return = Time::listTimezones(null, null, ['abbr' => true, 'before' => ' (', 'after' => ')']);
$this->assertEquals('Jayapura (WIT)', $return['Asia']['Asia/Jayapura']);
$this->assertEquals('Regina (CST)', $return['America']['America/Regina']);
$return = Time::listTimezones('#^(America|Pacific)/#', null, false);
$this->assertTrue(isset($return['America/Argentina/Buenos_Aires']));
$this->assertTrue(isset($return['Pacific/Tahiti']));
$return = Time::listTimezones(\DateTimeZone::ASIA);
$this->assertTrue(isset($return['Asia']['Asia/Bangkok']));
$this->assertFalse(isset($return['Pacific']));
$return = Time::listTimezones(\DateTimeZone::PER_COUNTRY, 'US', false);
$this->assertTrue(isset($return['Pacific/Honolulu']));
$this->assertFalse(isset($return['Asia/Bangkok']));
}