本文整理汇总了PHP中DateTimeUtil::get_utc_date_time方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::get_utc_date_time方法的具体用法?PHP DateTimeUtil::get_utc_date_time怎么用?PHP DateTimeUtil::get_utc_date_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::get_utc_date_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DateTimeUtil
function get_vcal_freebusy($user_focus, $cached = true)
{
global $locale;
$str = "BEGIN:VCALENDAR\n";
$str .= "VERSION:2.0\n";
$str .= "PRODID:-//SugarCRM//SugarCRM Calendar//EN\n";
$str .= "BEGIN:VFREEBUSY\n";
$name = $locale->getLocaleFormattedName($user_focus->first_name, $user_focus->last_name);
$email = $user_focus->email1;
// get current date for the user
$now_date_time = new DateTimeUtil(array(), true);
// get start date GMT ( 1 day ago )
$date_arr = array('day' => $now_date_time->day - 1, 'month' => $now_date_time->month, 'hour' => $now_date_time->hour, 'min' => $now_date_time->min, 'year' => $now_date_time->year);
$start_date_time = new DateTimeUtil($date_arr, true);
// get date 2 months from start date
global $sugar_config;
$timeOffset = 0;
if (isset($sugar_config['vcal_time']) && $sugar_config['vcal_time'] != 0 && $sugar_config['vcal_time'] < 13) {
$timeOffset = $sugar_config['vcal_time'];
}
$date_arr = array('day' => $start_date_time->day, 'month' => $start_date_time->month + $timeOffset, 'hour' => $start_date_time->hour, 'min' => $start_date_time->min, 'year' => $start_date_time->year);
$end_date_time = new DateTimeUtil($date_arr, true);
// get UTC time format
$utc_start_time = $start_date_time->get_utc_date_time();
$utc_end_time = $end_date_time->get_utc_date_time();
$utc_now_time = $now_date_time->get_utc_date_time();
$str .= "ORGANIZER;CN={$name}:{$email}\n";
$str .= "DTSTART:{$utc_start_time}\n";
$str .= "DTEND:{$utc_end_time}\n";
// now insert the freebusy lines
// retrieve cached freebusy lines from vcals
if ($timeOffset != 0) {
if ($cached == true) {
$str .= $this->get_freebusy_lines_cache($user_focus);
} else {
$str .= $this->create_sugar_freebusy($user_focus, $start_date_time, $end_date_time);
}
}
// UID:20030724T213406Z-10358-1000-1-12@phoenix
$str .= "DTSTAMP:{$utc_now_time}\n";
$str .= "END:VFREEBUSY\n";
$str .= "END:VCALENDAR\n";
return $str;
}
示例2: array
function get_vcal_freebusy(&$user_focus, $cached = true)
{
$str = "BEGIN:VCALENDAR\n";
$str .= "VERSION:2.0\n";
$str .= "PRODID:-//SugarCRM//SugarCRM Calendar//EN\n";
$str .= "BEGIN:VFREEBUSY\n";
$name = $user_focus->first_name . " " . $user_focus->last_name;
$email = $user_focus->email1;
// get current time local
$date_arr = array();
$now_date_time_local = new DateTimeUtil($date_arr, true);
// get current time GMT
$date_arr = array('ts' => $now_date_time_local->ts - $now_date_time_local->tz_offset);
$now_date_time = new DateTimeUtil($date_arr, true);
// get start date GMT ( 1 day ago )
$date_arr = array('day' => $now_date_time->day - 1, 'month' => $now_date_time->month, 'hour' => $now_date_time->hour, 'min' => $now_date_time->min, 'year' => $now_date_time->year);
$start_date_time = new DateTimeUtil($date_arr, true);
// get date 2 months from start date
$date_arr = array('day' => $start_date_time->day, 'month' => $start_date_time->month + 2, 'hour' => $start_date_time->hour, 'min' => $start_date_time->min, 'year' => $start_date_time->year);
$end_date_time = new DateTimeUtil($date_arr, true);
// get UTC time format
$utc_start_time = $start_date_time->get_utc_date_time();
$utc_end_time = $end_date_time->get_utc_date_time();
$utc_now_time = $now_date_time->get_utc_date_time();
$str .= "ORGANIZER;CN={$name}:{$email}\n";
$str .= "DTSTART:{$utc_start_time}\n";
$str .= "DTEND:{$utc_end_time}\n";
// now insert the freebusy lines
// retrieve cached freebusy lines from vcals
if ($cached == true) {
$str .= $this->get_freebusy_lines_cache($user_focus);
} else {
$str .= $this->create_sugar_freebusy($user_focus, $start_date_time, $end_date_time);
}
// UID:20030724T213406Z-10358-1000-1-12@phoenix
$str .= "DTSTAMP:{$utc_now_time}\n";
$str .= "END:VFREEBUSY\n";
$str .= "END:VCALENDAR\n";
return $str;
}