Computer >> Computer tutorials >  >> Programming >> PHP

timezone_offset_get() function in PHP


The timezone_offset_get() function returns the timezone offset from GMT.

Syntax

timezone_offset_get(obj, datetime)

Parameters

  • obj − Specifies the DateTimeZone object.

  • datetime − Specifies the DateTime that contains the date/time to compute the offset from.

Return

The timezone_offset_get() function returns the time zone offset in seconds on success or FALSE on failure.

Example

The following is an example −

<?php
   $tz = timezone_open("America/Chicago");
   $datetime = date_create("now", timezone_open("Europe/Amsterdam")); echo timezone_offset_get($tz, $datetime);
?>

Output

-18000