PHP date_timezone_get() Function

Example

Returns the time zone of the given DateTime object:

<?php
$date=date_create(null,timezone_open("Europe/Paris"));
$tz=date_timezone_get($date);
echo timezone_name_get($tz);
?>

Running Example

Definition and Usage

The date_timezone_get() function returns the time zone of the given DateTime object.

Syntax

date_timezone_get(object;
Parameter Description
object Required. Specifies by date_create() The returned DateTime object.

Technical Details

Return Value: Returns a DateTimeZone object on success, or FALSE on failure.
PHP Version: 5.2+