本文整理匯總了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;
}