PHP date_offset_get() Function

Example

Return the time zone offset in seconds from New York's winter and summer to UTC:

<?php
$winter=date_create("2016-10-15",timezone_open("America/New_York"));
$summer=date_create("2016-01-28",timezone_open("America/New_York"));
echo date_offset_get($winter) . " Seconds.<br />";
echo date_offset_get($summer) . " Seconds. ";
?>

Run Example

Definition and Usage

The date_offset_get() function returns the time zone offset.

Syntax

date_offset_get(object);
Parameter Description
object Required. Specifies by date_create() The returned DateTime object.

Technical Details

Return Value: If successful, returns the time zone offset from UTC in seconds, if failed, returns FALSE.
PHP Version: 5.2+