PHP | timezone_open() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 function accepts single parameter $timezone which is mandatory. It specify the timezone of the new DateTimeZone object to be created. Return Value: It returns the DateTimeZone object on success or False on failure. Exceptions: The timezone passed as a parameter must be a supported timezone in PHP else it may result in incorrect results. Below programs illustrate the timezone_open() function in PHP: Program 1: php <?php // Creating a new DateTimeZone object $timezone = timezone_open("America/Chicago"); echo ("The new DateTimeZone object created is " . timezone_name_get($timezone )); ?> Output: The new DateTimeZone object created is America/Chicago Program 2: php <?php // Array of timezones $timezones = array('Europe/London', 'Asia/Kolkata'); foreach ($timezones as $tz) { $name = timezone_open($tz); echo ("The new DateTimeZone object created is " . timezone_name_get($name). "<br>"); } ?> Output: The new DateTimeZone object created is Europe/LondonThe new DateTimeZone object created is Asia/Kolkata Note: The timezone_open() function gives warning since the timezone passed is not a supported/valid timezone. Reference: https://www.php.net/manual/en/function.timezone-open.php Comment More infoAdvertise with us Next Article PHP | timezone_name_get() Function S Shubrodeep Banerjee Follow Improve Article Tags : Misc Web Technologies PHP PHP-date-time PHP-function +1 More Practice Tags : Misc Similar Reads 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_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_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_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 | date_timezone_get() Function 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 1 min read PHP | date_timezone_get() Function 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 1 min read Like