PHP date_offset_get() Function
Definition
The date_offset_get() function returns the timezone offset.
Syntax
PHP date_offset_get() Function has the following syntax.
date_offset_get(object);
Parameter
object - Required. DateTime object returned by date_create()
Return
PHP date_offset_get() Function returns the timezone in seconds from UTC on success. FALSE on failure.
Example
Return the timezone offset for Oslo Norway, Europe in seconds from UTC, winter and summer:
<?php//from ww w . j av a 2s .c om
$winter=date_create("2013-12-31",timezone_open("Europe/Oslo"));
$summer=date_create("2013-06-30",timezone_open("Europe/Oslo"));
echo date_offset_get($winter) . " seconds.\n";
echo date_offset_get($summer) . " seconds.";
?>
The code above generates the following result.