PHP date_offset_get() Function

Example

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

<?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. ";
?>

Running Instance

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, it returns the time zone in seconds relative to UTC, and if failed, it returns FALSE.
PHP Version: 5.2+