Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

date_timezone_get()

Example

Retrieve the timezone from the specified DateTime object.

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

Definition and Usage

The date_timezone_get() function retrieves the timezone of the specified DateTime object.

Syntax

date_timezone_get(object)

Parameter Values

 

Parameter

Description

object

Required. Specifies a DateTime object created by date_create().

Technical Details

Return Value:

Returns a DateTimeZone object on success; FALSE on failure.

PHP Version:

5.2+