You are here

function _quiz_date in Quiz 6.6

Same name and namespace in other branches
  1. 8.4 quiz_datetime.inc \_quiz_date()
  2. 5.2 quiz_datetime.inc \_quiz_date()
  3. 5 quiz_datetime.inc \_quiz_date()
  4. 6.2 quiz_datetime.inc \_quiz_date()
  5. 6.3 quiz_datetime.inc \_quiz_date()
  6. 6.4 quiz_datetime.inc \_quiz_date()
  7. 6.5 quiz_datetime.inc \_quiz_date()
  8. 7 quiz_datetime.inc \_quiz_date()
  9. 7.4 quiz_datetime.inc \_quiz_date()

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.

Pulled from event

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

1 call to _quiz_date()
_quiz_form_prepare_date in ./quiz.module
Takes a time element and prepares to send it to form_date().

File

./quiz_datetime.inc, line 73
Handles the start and end times in a node form submission.

Code

function _quiz_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
  $result = gmdate($format, $timestamp);
  return $result;
}