Latest web development tutorials

PHP date_timezone_get () function

PHP Date / Time PHP Date / Time Reference Manual

Examples

Returns DateTime object given time zone:

<?php
$date=date_create(null,timezone_open("Europe/Paris"));
$tz=date_timezone_get($date);
echo timezone_name_get($tz);
?>

Running instance »

Definition and Usage

date_timezone_get () function returns the DateTime object given time zone.

grammar

date_timezone_get( object);

参数 描述
object 必需。规定一个由 date_create() 返回的 DateTime 对象。

technical details

return value: If successful DateTimeZone object, if fails returns FALSE.
PHP version: 5.2+


PHP Date / Time PHP Date / Time Reference Manual