PHP | date_timezone_get() Function Last Updated : 17 Sep, 2018 Comments Improve Suggest changes Like Article Like Report The date_timezone_get() function is an inbuilt function in PHP which is used to return time zone relative to given DateTime. This function returns a DateTimeZone object on success or False on failure. Syntax: Procedural style: date_timezone_get( $object ) Object oriented style: DateTime::getTimezone( void ) DateTimeImmutable::getTimezone( void ) DateTimeInterface::getTimezone( void ) Parameters: This function accepts single parameter $object which is mandatory in procedural style. It is used to specify the DateTime object which is returned by the date_create() function. The object oriented style does not require any parameter. Return Value: This function returns a DateTimeZone object on success or False on failure. Below programs illustrate the date_timezone_get() function in PHP: Program 1: php <?php // Create DateTime object $date = date_create(null, timezone_open('Asia/Kolkata')); // Return the timezone of given DateTime $time_zone = date_timezone_get($date); // Return the DateTimeZone object echo timezone_name_get($time_zone); ?> Output: Asia/Kolkata Program 2: php <?php // Create DateTime object using DateTimeZone $date = new DateTime(null, new DateTimeZone('Asia/Kolkata')); // Return the timezone of given DateTime $time_zone = $date->getTimezone(); // Return the DateTimeZone object echo $time_zone->getName(); ?> Output: Asia/Kolkata Related Articles: PHP | timezone_version_get() Function PHP | gmdate() Function PHP | date_date_set() Function Reference: http://php.net/manual/en/datetime.gettimezone.php Comment More infoAdvertise with us Next Article PHP | date_timezone_get() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads PHP | date_default_timezone_get() Function The date_default_timezone_get() function is an inbuilt function in PHP which is used to gets the default timezone used by all date/time functions in a script. Syntax: string date_default_timezone_get( void ) Parameter: This function does not accept any parameter.Return Value: This function returns a 2 min read PHP | date_timezone_set() Function The date_timezone_set() function is an inbuilt function in PHP which is used to sets the time zone for the DateTime object. This function returns the DateTime object or False on failure. Syntax: Procedural style: date_timezone_set( $object, $timezone ) Object oriented style: DateTime::setTimezone( $ 2 min read PHP | date_timestamp_get() Function The date_timestamp_get() function is an inbuilt function in PHP which is used to gets the Unix timestamp. This function returns the Unix timestamp representing the date. Syntax: Procedural style: int date_timestamp_get( $object ) Object oriented style: int DateTime::getTimestamp( void ) int DateTime 1 min read PHP | timezone_name_get() Function The timezone_name_get() function is an inbuilt function in PHP which is used to return the name of the timezone. The date time object is sent as a parameter to the timezone_name_get() function and it returns the name of the timezone on success or False on failure. Syntax: string timezone_name_get( $ 2 min read PHP | timezone_open() Function The timezone_open() function is an inbuilt function in PHP which is used to create a new DateTimeZone object. The timezone_open() function accepts the timezone as a parameter and returns the DateTimeZone object on success or False on failure. Syntax: timezone_open( $timezone ) Parameters: This funct 2 min read PHP | timezone_offset_get() Function The timezone_offset_get() function is an inbuilt function in PHP which is used to return the timezone offset from GMT. The date time object and the date-time are sent as a parameter to the timezone_offset_get() function and return the timezone offset in seconds on success or False on failure. Syntax 2 min read PHP | timezone_version_get() Function The timezone_version_get() function is an inbuilt function in PHP which is used to return the version of the timezone database. No parameters are required to be passed in the timezone_version_get() function. Syntax: string timezone_version_get() Parameters: The timezone_version_get() function does n 1 min read PHP | date_time_set() Function The date_time_set() function is an inbuilt function in PHP which is used to sets the time. This function resets the current time of the DateTime object to a different time. Syntax: Procedural style: date_time_set( $object, $hour, $minute, $second, $microseconds ) Object oriented style: DateTime::set 2 min read PHP | timezone_location_get() Function The timezone_location_get() function is an inbuilt function in PHP which is used to return the location information for the given timezone. The date time object is sent as a parameter to the timezone_location_get() function and it returns location information related to the timezone on success or Fa 2 min read PHP | date_default_timezone_set() Function The date_default_timezone_set() function is an inbuilt function in PHP which is used to set the default timezone used by all date/time functions in a script. This function returns False if the timezone is not valid, or True otherwise. Syntax: bool date_default_timezone_set( $timezone_identifier ) Pa 2 min read Like