PHP Tutorial - PHP timezone_open() Function






Definition

The timezone_open() creates a new DateTimeZone object.

Syntax

PHP timezone_open() Function has the following syntax.

timezone_open(timezone)

Parameter

PHP timezone_open() Function has the following parameter.

  • timezone - Required. A timezone

Return

PHP timezone_open() Function returns the DateTimeZone object on success. FALSE on failure.

Example

Create a new DateTimeZone object, then return the name of the timezone:


<?php
$tz=timezone_open("Europe/Paris");
echo timezone_name_get($tz);
?>

The code above generates the following result.