PHP date_timezone_get() Function

Definition

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

Syntax

PHP date_timezone_get() Function has the following syntax.

date_timezone_get(object);

Parameter

PHP date_timezone_get() Function has the following parameters.

  • object - Required. DateTime object returned by date_create().

Return

PHP date_timezone_get() Function returns a DateTimeZone object on success. FALSE on failure.

Example

Return the timezone of the given DateTime object:


<?php//from  w  w w .j a  v  a 2 s  .com
    $date=date_create(null,timezone_open("Europe/Paris"));
    $tz=date_timezone_get($date);
    echo timezone_name_get($tz);
?>

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