DateTime
PHP Manual

DateTime::getTimezone

(PHP 5 >= 5.2.0)

DateTime::getTimezoneReturn time zone relative to given DateTime

Opis

public DateTimeZone DateTime::getTimezone ( void )

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

Zwracane wartości

Returns DateTimeZone object on success or FALSE on failure.

Przykłady

Przykład #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();
?>

Powyższy przykład wyświetli:

Europe/London
America/Los_Angeles

Zobacz też:


DateTime
PHP Manual