1--TEST-- 2Test new DateTime() : basic functionality 3--FILE-- 4<?php 5/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] ) 6 * Description: Returns new DateTime object 7 * Source code: ext/date/php_date.c 8 * Alias to functions: 9 */ 10 11//Set the default time zone 12date_default_timezone_set("Europe/London"); 13 14echo "*** Testing new DateTime() : basic functionality ***\n"; 15 16var_dump( new DateTime('') ); 17 18var_dump( new DateTime("GMT") ); 19var_dump( new DateTime("2005-07-14 22:30:41") ); 20var_dump( new DateTime("2005-07-14 22:30:41 GMT") ); 21 22?> 23===DONE=== 24--EXPECTF-- 25*** Testing new DateTime() : basic functionality *** 26object(DateTime)#%d (3) { 27 ["date"]=> 28 string(%d) "%s" 29 ["timezone_type"]=> 30 int(3) 31 ["timezone"]=> 32 string(13) "Europe/London" 33} 34object(DateTime)#%d (3) { 35 ["date"]=> 36 string(%d) "%s" 37 ["timezone_type"]=> 38 int(2) 39 ["timezone"]=> 40 string(3) "GMT" 41} 42object(DateTime)#%d (3) { 43 ["date"]=> 44 string(19) "2005-07-14 22:30:41" 45 ["timezone_type"]=> 46 int(3) 47 ["timezone"]=> 48 string(13) "Europe/London" 49} 50object(DateTime)#%d (3) { 51 ["date"]=> 52 string(19) "2005-07-14 22:30:41" 53 ["timezone_type"]=> 54 int(2) 55 ["timezone"]=> 56 string(3) "GMT" 57} 58===DONE=== 59