PHP timezone_open() Function

Example

Create a new DateTimeZone object and then return the name of the time zone:

<?php
$tz=timezone_open("Asia/Shanghai");
echo timezone_name_get($tz);
?>

Run Example

Definition and Usage

timezone_open() creates a new DateTimeZone object.

Syntax

timezone_open(timezone);
Parameter Description
timezone

Required. Specifies the time zone.

Tip:View all supported time zones in PHP..

Technical Details

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