Computer >> Computer tutorials >  >> Programming >> PHP

date_timezone_get() function in PHP


The date_timezone_get() function return time zone relative to given DateTime.

Syntax

date_timezone_get(obj)

Parameters

  • obj − Specifies the DateTime object.

Return

The date_timezone_get() function returns DateTimeZone object on success or FALSE on failure.

Example

The following is an example −

<?php
   $dt = date_create(null,timezone_open("Asia/Kolkata"));
   $time_zone = date_timezone_get($dt);
   echo timezone_name_get($time_zone);
?>

Output

Asia/Kolkata