PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

date> <date_timezone_get
Last updated: Fri, 02 Jan 2009

view this page in

date_timezone_set

(PHP 5 >= 5.2.0)

date_timezone_setSets the time zone for the DateTime object

Opis

void date_timezone_set ( DateTime $object , DateTimeZone $timezone )
void DateTime::setTimezone ( DateTimeZone $timezone )

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

timezone

Desired time zone.

Zwracane wartości

Returns NULL on success or FALSE on failure.

Przykłady

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();
?>

Powyższy przykład wyświetli:

Europe/London
America/Los_Angeles



add a note add a note User Contributed Notes
date_timezone_set
There are no user contributed notes for this page.

date> <date_timezone_get
Last updated: Fri, 02 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites