You are here

function calendar_mktime in Calendar 5

Formats local time values to GMT timestamp using time zone offset supplied. All time values in the database are GMT and translated here prior to insertion.

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

File

./calendar_api.inc, line 317

Code

function calendar_mktime($hour, $minute, $second, $month, $day, $year, $offset = NULL) {
  global $user;
  calendar_load_date_api();
  $timestamp = date_gmmktime(array(
    'hours' => $hour,
    'minutes' => $minute,
    'seconds' => $second,
    'mon' => $month,
    'day' => $day,
    'year' => $year,
  ));
  if (isset($offset)) {
    return $timestamp - $offset;
  }
  elseif (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone) && variable_get('event_timezone_display', 'event') == 'user') {
    return $timestamp - $user->timezone;
  }
  else {
    return $timestamp - variable_get('date_default_timezone', 0);
  }
}