當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Time::listTimezones方法代碼示例

本文整理匯總了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']));
 }
開發者ID:RogerSchmeier,項目名稱:Webtruck,代碼行數:28,代碼來源:TimeTest.php

示例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']));
 }
開發者ID:trinhbiendich,項目名稱:cake,代碼行數:35,代碼來源:TimeTest.php


注:本文中的Cake\I18n\Time::listTimezones方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。