PHP timezone_offset_get() Function

Definition

The timezone_offset_get() returns the timezone offset from GMT.

Syntax

PHP timezone_offset_get() Function has the following

timezone_offset_get(object,datetime)

Parameter

ParameterIs RequiredDescription
objectRequired.DateTimeZone object returned by timezone_open()
datetimeRequired.date/time to compute the offset from

Return

PHP timezone_offset_get() Function returns the timezone offset in seconds on success. FALSE on failure.

Example

Return the timezone offset from GMT:


<?php// w  w  w.ja v  a 2s.  co  m
$tz=timezone_open("Asia/Taipei");
$dateTimeOslo=date_create("now",timezone_open("Europe/Oslo"));
echo timezone_offset_get($tz,$dateTimeOslo);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions