The timezone_offset_get() returns the timezone offset from GMT.
PHP timezone_offset_get() Function has the following
timezone_offset_get(object,datetime)
Parameter | Is Required | Description |
---|---|---|
object | Required. | DateTimeZone object returned by timezone_open() |
datetime | Required. | date/time to compute the offset from |
PHP timezone_offset_get() Function returns the timezone offset in seconds on success. FALSE on failure.
Return the timezone offset from GMT:
<?php
$tz=timezone_open("Asia/Taipei");
$dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));
echo timezone_offset_get($tz,$dateTimeOslo);
?>
The code above generates the following result.