1--TEST-- 2Test DateTime::setTimezone() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone ) 6 * Description: Sets the time zone for the DateTime object 7 * Source code: ext/date/php_date.c 8 * Alias to functions: date_timezone_set 9 */ 10 11echo "*** Testing DateTime::setTimezone() : basic functionality ***\n"; 12 13//Set the default time zone 14date_default_timezone_set("Europe/London"); 15 16$datetime = new DateTime("2009-01-30 17:57:32"); 17echo "Default timezone: " . date_timezone_get($datetime)->getName() . "\n"; 18 19$la_time = new DateTimezone("America/Los_Angeles"); 20$datetime->setTimezone($la_time); 21echo "New timezone: " . date_timezone_get($datetime)->getName() . "\n"; 22 23?> 24===DONE=== 25--EXPECTF-- 26*** Testing DateTime::setTimezone() : basic functionality *** 27Default timezone: Europe/London 28New timezone: America/Los_Angeles 29===DONE=== 30