function calendar_event_date in Calendar 5
Formats a GMT timestamp to local date values using time zone offset supplied. All timestamp values in event nodes are GMT and translated for display here.
Time zone settings are applied in the following order 1. If supplied, time zone offset is applied 2. If user time zones are enabled, user time zone offset is applied 3. If neither 1 nor 2 apply, the site time zone offset is applied
Parameters
$format The date() format to apply to the timestamp.:
$timestamp The GMT timestamp value.:
$offset Time zone offset to apply to the timestamp.:
Return value
date_format_date() formatted date value
1 call to calendar_event_date()
- calendar_get_calendar in ./
calendar_api.inc - Adapted from event_get_calendar() function in the event module Reworked to remove dependency on event module
File
- ./
calendar_api.inc, line 389
Code
function calendar_event_date($format, $timestamp, $offset = null) {
global $user;
calendar_load_date_api();
if (isset($offset)) {
$timestamp += $offset;
}
elseif (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timestamp += $user->timezone;
}
else {
$timestamp += variable_get('date_default_timezone', 0);
}
// make sure we apply the site first day of the week setting for dow requests
if ($format == 'w') {
$result = calendar_day_of_week($timestamp);
}
else {
$result = date_format_date($format, $timestamp);
}
return $result;
}