Return the timezone offset from GMT in PHP

Description

The following code shows how to return the timezone offset from GMT.

Example


  /*w w  w  .  j a  va 2s.c o  m*/
<?php
    $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 »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone