PHP timezone_offset_get() Function

Example

Returns the timezone offset relative to GMT:

<?php
$tz=timezone_open("Asia/Taipei");
$dateTimeNY=date_create("now",timezone_open("America/New_York"));
echo timezone_offset_get($tz,$dateTimeNY);
?>

Running Example

Definition and Usage

timezone_offset_get() returns the timezone offset relative to GMT.

Syntax

timezone_offset_get(object,datetime);
Parameter Description
object Required. Specifies by timezone_open() The returned DateTimeZone object.
datetime Required. Specifies the date/time for which the offset needs to be calculated.

Technical Details

Return Value: Returns the timezone offset in seconds if successful, FALSE otherwise.
PHP Version: 5.2+