You are here

function _event_date in Event 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

gmdate() formatted date value

Related topics

4 calls to _event_date()
event_calendar_data in ./event.module
Returns an array of nodes that occur on a given date. Handles content type and taxonomy filters.
event_form_alter in ./event.module
event_form_date in ./event.module
Constructs the time select boxes.
event_get_calendar in ./event.module
Returns a calendar in the requested format, populated with the provided nodes. This is not used internally, rather it is an API funciton for external modules to use for rendering calendars when constructing thier own event objects.

File

./event.module, line 1359

Code

function _event_date($format, $timestamp, $offset = null) {
  global $user;
  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 = _event_day_of_week($timestamp);
  }
  else {
    $result = gmdate($format, $timestamp);
  }
  return $result;
}