PHP timezone_offset_get() Function
Example
Return 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); ?>
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 to calculate the offset. |
Technical Details
Return Value: | If successful, it returns the timezone offset in seconds, and if failed, it returns FALSE. |
---|---|
PHP Version: | 5.2+ |