本文整理汇总了PHP中DateTimeField::convertTimeZone方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::convertTimeZone方法的具体用法?PHP DateTimeField::convertTimeZone怎么用?PHP DateTimeField::convertTimeZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::convertTimeZone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convertToDBTimeZone
/**
*
* @global Users $current_user
* @param type $value
* @param Users $user
*/
public static function convertToDBTimeZone($value, $user = null, $formatDate = true)
{
global $log, $current_user, $default_timezone;
$log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__ . "({$value})");
if (empty($user)) {
$user = $current_user;
}
$timeZone = $user->time_zone ? $user->time_zone : $default_timezone;
if ($formatDate) {
$value = self::sanitizeDate($value, $user);
}
$return = DateTimeField::convertTimeZone($value, $timeZone, self::getDBTimeZone());
$log->debug('End ' . __CLASS__ . ':' . __FUNCTION__);
return $return;
}
示例2: getEndDate
/**
* return End date in UTC of Google Record
* @return <date> end date
*/
function getEndDate($user = false)
{
if (isset($this->endUTC)) {
return $this->endUTC;
}
if (!$user) {
$user = Users_Record_Model::getCurrentUserModel();
}
$when = $this->data['entity']->getEnd();
if (empty($when)) {
$gEnd = date('Y-m-d');
} else {
if ($when->getDateTime()) {
$gEnd = $when->getDateTime();
} else {
if ($when->getDate()) {
$gEnd = $when->getDate();
} else {
$gEnd = date('Y-m-d');
}
}
}
$end = new DateTime($gEnd);
$timeZone = new DateTimeZone('UTC');
$end->setTimezone($timeZone);
$endDate = $end->format('Y-m-d');
$gDateTime = $when->getDateTime();
if ($end->format('H:i:s') == '00:00:00' && empty($gDateTime)) {
$userTimezone = $user->get('time_zone');
$endUTCObj = DateTimeField::convertTimeZone($endDate, $userTimezone, DateTimeField::getDBTimeZone());
$endDate = $endUTCObj->format('Y-m-d');
}
$this->endDate = $endDate;
return $endDate;
}
示例3: convertToDBTimeZone
/**
*
* @global Users $current_user
* @param type $value
* @param Users $user
*/
public static function convertToDBTimeZone($value, $user = null)
{
global $current_user, $default_timezone;
if (empty($user)) {
$user = $current_user;
}
$timeZone = $user->time_zone ? $user->time_zone : $default_timezone;
$value = self::sanitizeDate($value, $user);
return DateTimeField::convertTimeZone($value, $timeZone, self::getDBTimeZone());
}
示例4: convertToDBTimeZone
/**
*
* @global Users $current_user
* @param type $value
* @param Users $user
*/
public static function convertToDBTimeZone($value, $user = null)
{
global $log, $current_user, $default_timezone;
$log->debug("Entering convertToDBTimeZone({$value}) method ...");
if (empty($user)) {
$user = $current_user;
}
$timeZone = $user->time_zone ? $user->time_zone : $default_timezone;
$value = self::sanitizeDate($value, $user);
$log->debug("Exiting convertTimeZone method ...");
return DateTimeField::convertTimeZone($value, $timeZone, self::getDBTimeZone());
}