本文整理汇总了PHP中PhabricatorUser::getTimeZone方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getTimeZone方法的具体用法?PHP PhabricatorUser::getTimeZone怎么用?PHP PhabricatorUser::getTimeZone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorUser
的用法示例。
在下文中一共展示了PhabricatorUser::getTimeZone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeViewerTimezone
public function removeViewerTimezone(PhabricatorUser $viewer)
{
if (!$this->appliedViewer) {
throw new Exception(pht('Viewer timezone is not applied!'));
}
if ($viewer->getPHID() != $this->appliedViewer->getPHID()) {
throw new Exception(pht('Removed viewer must match applied viewer!'));
}
$this->appliedViewer = null;
if (!$this->getIsAllDay()) {
return $this;
}
$zone = $viewer->getTimeZone();
$this->setDateFrom($this->getDateEpochForTimeZone($this->getDateFrom(), $zone, 'Y-m-d', null, new DateTimeZone('Pacific/Kiritimati')));
$this->setDateTo($this->getDateEpochForTimeZone($this->getDateTo(), $zone, 'Y-m-d', '+1 day', new DateTimeZone('Pacific/Midway')));
return $this;
}
示例2: getDateTimeFromEpoch
public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer)
{
$datetime = new DateTime('@' . $epoch);
$datetime->setTimeZone($viewer->getTimeZone());
return $datetime;
}
示例3: applyViewerTimezone
public function applyViewerTimezone(PhabricatorUser $viewer)
{
if (!$this->getIsAllDay()) {
$this->viewerDateFrom = $this->getDateFrom();
$this->viewerDateTo = $this->getDateTo();
} else {
$zone = $viewer->getTimeZone();
$this->viewerDateFrom = $this->getDateEpochForTimezone($this->getAllDayDateFrom(), new DateTimeZone('UTC'), 'Y-m-d', null, $zone);
$this->viewerDateTo = $this->getDateEpochForTimezone($this->getAllDayDateTo(), new DateTimeZone('UTC'), 'Y-m-d 23:59:00', null, $zone);
}
return $this;
}