Freelance PHP programmer India | Freelance web developer india | Web development India | web developer CV india | Compiling PHP and Apache 2 from source on Linux
DateTime
PHP Manual

DateTime::getTimezone

(No version information available, might be only in CVS)

DateTime::getTimezoneReturn time zone relative to given DateTime

Description

public DateTimeZone DateTime::getTimezone ( void )

Parameters

object

Procedural style only: A DateTime object returned by date_create()

Return Values

Returns DateTimeZone object on success or FALSE on failure.

Examples

Example #1 Setting and getting DateTimeZone objects

<?php
date_default_timezone_set
('Europe/London');

$datetime = new DateTime('2008-08-03 12:35:23');
echo 
$datetime->getTimezone()->getName() . "\n";

$datetime = new DateTime('2008-08-03 12:35:23');
$la_time = new DateTimeZone('America/Los_Angeles');
$datetime->setTimezone($la_time);
echo 
$datetime->getTimezone()->getName();
?>

The above example will output:

Europe/London
America/Los_Angeles

See Also


DateTime
PHP Manual