You are here

function date_ical_date in Date 6

Same name and namespace in other branches
  1. 5.2 date_api_ical.inc \date_ical_date()
  2. 5 date_api_ical.inc \date_ical_date()
  3. 6.2 date_api_ical.inc \date_ical_date()
  4. 7.3 date_api/date_api_ical.inc \date_ical_date()
  5. 7 date_api/date_api_ical.inc \date_ical_date()
  6. 7.2 date_api/date_api_ical.inc \date_ical_date()

Return a date object for the ical date, adjusted to its local timezone.

Parameters

$ical_date: an array of ical date information created in the ical import. @param $to_tz the timezone to convert the date's value to. @return object a timezone-adjusted date object

4 calls to date_ical_date()
date_copy_import_ical_form_submit in date_copy/date_copy.module
date_repeat_rrule_description in date_repeat/date_repeat.module
Build a description of an iCal rule.
_date_repeat_calc in date_repeat/date_repeat_calc.inc
Private implementation of date_repeat_calc().
_date_repeat_widget_validate in date/date_repeat.inc
Validation for date repeat form element.

File

./date_api_ical.inc, line 501
Parse iCal data.

Code

function date_ical_date($ical_date, $to_tz = FALSE) {

  // If the ical date has no timezone, must assume it is stateless
  // so treat it as a local date.
  if (empty($ical_date['tz'])) {
    $from_tz = date_default_timezone_name();
  }
  else {
    $from_tz = $ical_date['tz'];
  }
  $date = date_make_date($ical_date['datetime'], $from_tz);
  if ($to_tz && $ical_date['tz'] != '' && $to_tz != $ical_date['tz']) {
    $date = date_timezone_set($date, timezone_open($to_tz));
  }
  return $date;
}