1--TEST-- 2Test DateTime::getTimezone() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : public DateTimeZone DateTime::getTimezone ( void ) 6 * Description: Return time zone relative to given DateTime 7 * Source code: ext/date/php_date.c 8 * Alias to functions: date_timezone_get 9 */ 10 11echo "*** Testing DateTime::getTimezone() : basic functionality ***\n"; 12 13date_default_timezone_set("Europe/London"); 14$object = new DateTime("2009-01-30 17:57:32"); 15var_dump( $object->getTimeZone()->getName() ); 16 17 18date_default_timezone_set("America/New_York"); 19$object = new DateTime("2009-01-30 17:57:32"); 20var_dump( $object->getTimeZone()->getName() ); 21 22$la_time = new DateTimeZone("America/Los_Angeles"); 23$object->setTimeZone($la_time); 24var_dump( $object->getTimeZone()->getName() ); 25 26?> 27===DONE=== 28--EXPECTF-- 29*** Testing DateTime::getTimezone() : basic functionality *** 30string(13) "Europe/London" 31string(16) "America/New_York" 32string(19) "America/Los_Angeles" 33===DONE=== 34