function get_timezone_offset
Search API
7.x misc.inc | get_timezone_offset($remote_tz, $origin_tz = null) |
6.x misc.inc | get_timezone_offset($remote_tz, $origin_tz = null) |
Returns the offset from the origin timezone to the remote timezone, in seconds.
Parameters
$remote_tz;:
- @param $origin_tz; If null the servers current timezone is used as the origin.
- @return int;
2 calls to get_timezone_offset()
- calendar_get_available_times_on_date in modules/
calendar/ calendar.module - calendar_schedule_appointment_confirm_form in modules/
calendar/ calendar.module - The confirmation form the user will see once they have made their schedule selections.
File
- includes/
misc.inc, line 320 - This file contains misc functions for FlightPath
Code
function get_timezone_offset($remote_tz, $origin_tz = null) {
if ($origin_tz === null) {
if (!is_string($origin_tz = date_default_timezone_get())) {
return false; // A UTC timestamp was returned -- bail out!
}
}
$origin_dtz = new DateTimeZone($origin_tz);
$remote_dtz = new DateTimeZone($remote_tz);
$origin_dt = new DateTime("now", $origin_dtz);
$remote_dt = new DateTime("now", $remote_dtz);
$offset = $origin_dtz->getOffset($origin_dt) - $remote_dtz->getOffset($remote_dt);
return $offset;
}