1--TEST-- 2Test date_time_set() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) 6 * Description: Resets the current time of the DateTime object to a different time. 7 * Source code: ext/date/php_date.c 8 * Alias to functions: DateTime::setTime 9 */ 10 11 //Set the default time zone 12date_default_timezone_set("Europe/London"); 13 14echo "*** Testing date_time_set() : basic functionality ***\n"; 15 16// Create a DateTime object 17$datetime = date_create("2009-01-31 15:14:10"); 18 19echo "Initial date: " . date_format($datetime, DATE_RFC2822) . "\n"; 20 21date_time_set($datetime, 17, 20); 22echo "After modification1 " . date_format($datetime, DATE_RFC2822) . "\n"; 23 24date_time_set($datetime, 19, 05, 59); 25echo "After modification2 " . date_format($datetime, DATE_RFC2822) . "\n"; 26 27date_time_set($datetime, 24, 10); 28echo "After modification3 " . date_format($datetime, DATE_RFC2822) . "\n"; 29 30date_time_set($datetime, 47, 35, 47); 31echo "After modification4 " . date_format($datetime, DATE_RFC2822) . "\n"; 32 33date_time_set($datetime, 54, 25); 34echo "After modification5 " . date_format($datetime, DATE_RFC2822) . "\n"; 35 36?> 37===DONE=== 38--EXPECTF-- 39*** Testing date_time_set() : basic functionality *** 40Initial date: Sat, 31 Jan 2009 15:14:10 +0000 41After modification1 Sat, 31 Jan 2009 17:20:00 +0000 42After modification2 Sat, 31 Jan 2009 19:05:59 +0000 43After modification3 Sun, 01 Feb 2009 00:10:00 +0000 44After modification4 Mon, 02 Feb 2009 23:35:47 +0000 45After modification5 Wed, 04 Feb 2009 06:25:00 +0000 46===DONE=== 47