当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorUser::overrideTimezoneIdentifier方法代码示例

本文整理汇总了PHP中PhabricatorUser::overrideTimezoneIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::overrideTimezoneIdentifier方法的具体用法?PHP PhabricatorUser::overrideTimezoneIdentifier怎么用?PHP PhabricatorUser::overrideTimezoneIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorUser的用法示例。


在下文中一共展示了PhabricatorUser::overrideTimezoneIdentifier方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testParseLocalTime

 public function testParseLocalTime()
 {
     $u = new PhabricatorUser();
     $u->overrideTimezoneIdentifier('UTC');
     $v = new PhabricatorUser();
     $v->overrideTimezoneIdentifier('America/Los_Angeles');
     $t = 1370202281;
     // 2013-06-02 12:44:41 -0700
     $time = PhabricatorTime::pushTime($t, 'America/Los_Angeles');
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('now', $u));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('now', $v));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 12:44:41 -0700', $u));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 12:44:41 -0700', $v));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 12:44:41 PDT', $u));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 12:44:41 PDT', $v));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 19:44:41', $u));
     $this->assertEqual($t, PhabricatorTime::parseLocalTime('2013-06-02 12:44:41', $v));
     $this->assertEqual($t + 3600, PhabricatorTime::parseLocalTime('+1 hour', $u));
     $this->assertEqual($t + 3600, PhabricatorTime::parseLocalTime('+1 hour', $v));
     unset($time);
     $t = 1370239200;
     // 2013-06-02 23:00:00 -0700
     $time = PhabricatorTime::pushTime($t, 'America/Los_Angeles');
     // For the UTC user, midnight was 6 hours ago because it's early in the
     // morning for htem. For the PDT user, midnight was 23 hours ago.
     $this->assertEqual($t + -6 * 3600 + 60, PhabricatorTime::parseLocalTime('12:01:00 AM', $u));
     $this->assertEqual($t + -23 * 3600 + 60, PhabricatorTime::parseLocalTime('12:01:00 AM', $v));
     unset($time);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:29,代码来源:PhabricatorTimeTestCase.php

示例2: testLocalTimeFormatting

 public function testLocalTimeFormatting()
 {
     $user = new PhabricatorUser();
     $user->overrideTimezoneIdentifier('America/Los_Angeles');
     $utc = new PhabricatorUser();
     $utc->overrideTimezoneIdentifier('UTC');
     $this->assertEqual('Jan 1 2000, 12:00 AM', phabricator_datetime(946684800, $utc), pht('Datetime formatting'));
     $this->assertEqual('Jan 1 2000', phabricator_date(946684800, $utc), pht('Date formatting'));
     $this->assertEqual('12:00 AM', phabricator_time(946684800, $utc), pht('Time formatting'));
     $this->assertEqual('Dec 31 1999, 4:00 PM', phabricator_datetime(946684800, $user), pht('Localization'));
     $this->assertEqual('', phabricator_datetime(0, $user), pht('Missing epoch should fail gracefully'));
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:12,代码来源:PhabricatorLocalTimeTestCase.php

示例3: testTimestampsStartDay

 public function testTimestampsStartDay()
 {
     $u = new PhabricatorUser();
     $u->overrideTimezoneIdentifier('America/Los_Angeles');
     $days = $this->getAllDays();
     foreach ($days as $day) {
         $data = CalendarTimeUtil::getTimestamps($u, $day, 1);
         $this->assertEqual($day, $data['epoch_stamps'][0]->format('l'));
     }
     $t = 1370202281;
     // 2013-06-02 12:44:41 -0700 -- a Sunday
     $time = PhabricatorTime::pushTime($t, 'America/Los_Angeles');
     foreach ($days as $day) {
         $data = CalendarTimeUtil::getTimestamps($u, $day, 1);
         $this->assertEqual($day, $data['epoch_stamps'][0]->format('l'));
     }
     unset($time);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:18,代码来源:CalendarTimeUtilTestCase.php


注:本文中的PhabricatorUser::overrideTimezoneIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。