Get time zone relative to given DateTime in PHP

Description

The following code shows how to get time zone relative to given DateTime.

Example


//from w ww  . j  av  a2  s  . c  o  m
<?php
//null means get current time
$date = new DateTime(null, new DateTimeZone('Europe/London'));
$tz = $date->getTimezone();
echo $tz->getName();
?>

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