PHP timezone_open() functiun

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. Specify the time zone.

Tip:View the list of all time zones supported in PHP.

Technical Details

Return Value: If successful, it returns a DateTimeZone object, and if it fails, it returns FALSE.
PHP Version: 5.2+