Home >>PHP Date Time Functions >PHP date_offset_get() Function

PHP date_offset_get() Function

PHP date_offset_get() Function

The date_offset_get() Function is used to Return the timezone offset for Oslo (in Norway, Europe) in seconds from UTC, winter and summer: This function returns true when the timezone offset in seconds from UTC (Universal Time Coordinated) or FALSE on failure.

synatx:

date_offset_get(object)

Parameter Values

Parameter Description
object This is a required parameter.This parameter specifies a DateTime object returned by date_create().

Here the example of date_offset_get() Function in PHP

<html>
<body>
<?php
$winter=date_create("2013-11-28",timezone_open("Asia/kolkata"));
$summer=date_create("2013-08-30",timezone_open("Europe/Oslo"));
echo date_offset_get($winter) . " seconds.<br>";
echo date_offset_get($summer) . " seconds.";
?>
</body>
</html>
Output:
19800 seconds.
7200 seconds.

Example 2:

<html>
<body>
<?php
$winter=date_create("2013-11-27",timezone_open("Asia/kolkata"));
$summer=date_create("2013-10-30",timezone_open("Asia/kolkata"));
echo date_offset_get($winter) . " seconds.<br>";
echo date_offset_get($summer) . " seconds.";
?>
</body>
</html>
Output:
19800 seconds
19800 seconds

No Sidebar ads