本文整理汇总了PHP中SugarDateTime::format方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarDateTime::format方法的具体用法?PHP SugarDateTime::format怎么用?PHP SugarDateTime::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarDateTime
的用法示例。
在下文中一共展示了SugarDateTime::format方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function __construct($view, $time_arr = array())
{
global $current_user, $timedate;
global $sugar_config;
if ($current_user->getPreference('time')) {
$time = $current_user->getPreference('time');
} else {
$time = $sugar_config['default_time_format'];
}
if (substr_count($time, 'h') > 0) {
$this->use_24 = 0;
}
if (!($view == 'day' || $view == 'month' || $view == 'year' || $view == 'week' || $view == 'shared')) {
sugar_die("view needs to be one of: day, week, month, shared, or year");
}
$this->view = $view;
if (isset($time_arr['activity_focus'])) {
$this->activity_focus = new CalendarActivity($time_arr['activity_focus']);
$this->date_time = $this->activity_focus->start_time;
} else {
if (!empty($time_arr)) {
// FIXME: what format?
$this->date_time = $timedate->fromTimeArray($time_arr);
} else {
$this->date_time = $timedate->getNow();
}
}
$timedate->tzUser($this->date_time, $current_user);
$GLOBALS['log']->debug("CALENDATE: " . $this->date_time->format('r'));
$this->create_slices();
}
示例2: getUtcDateTime
/**
* Gets a UTC formatted string from the given dateTime
*
* @param SugarDateTime $dateTime the dateTime to format
* @return string the UTC formatted dateTime
*/
protected function getUtcDateTime($dateTime)
{
return $dateTime->format(self::UTC_FORMAT);
}
示例3: empty
/**
* @deprecated for public use
* handles offset values for Timezones and DST
* @param $date string date/time formatted in user's selected format
* @param $format string destination format value as passed to PHP's date() funtion
* @param $to boolean
* @param $user object user object from which Timezone and DST
* @param $usetimezone string timezone name
* values will be derived
* @return string date formatted and adjusted for TZ and DST
*/
function handle_offset($date, $format, $to = true, $user = null, $usetimezone = null)
{
$tz = empty($usetimezone) ? $this->_getUserTZ($user) : new DateTimeZone($usetimezone);
$dateobj = new SugarDateTime($date, $to ? self::$gmtTimezone : $tz);
$dateobj->setTimezone($to ? $tz : self::$gmtTimezone);
return $dateobj->format($format);
// return $this->_convert($date, $format, $to ? self::$gmtTimezone : $tz, $format, $to ? $tz : self::$gmtTimezone);
}