1--TEST--
2Test DateTime::setTime() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : public DateTime DateTime::setTime  ( 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: date_time_set
9 */
10
11 //Set the default time zone
12date_default_timezone_set("Europe/London");
13
14echo "*** Testing DateTime::setTime() : basic functionality ***\n";
15
16// Create a DateTime object
17$datetime = new DateTime("2009-01-31 15:14:10");
18
19echo "Initial date: " . $datetime ->format(DATE_RFC2822) . "\n";
20
21$datetime->setTime(17, 20);
22echo "After modification1 " . $datetime ->format(DATE_RFC2822) . "\n";
23
24$datetime->setTime(19, 05, 59);
25echo "After modification2 " . $datetime ->format(DATE_RFC2822) . "\n";
26
27$datetime->setTime(24, 10);
28echo "After modification3 " . $datetime ->format(DATE_RFC2822) . "\n";
29
30$datetime->setTime(47, 35, 47);
31echo "After modification4 " . $datetime ->format(DATE_RFC2822) . "\n";
32
33$datetime->setTime(54, 25);
34echo "After modification5 " . $datetime ->format(DATE_RFC2822) . "\n";
35
36?>
37===DONE===
38--EXPECTF--
39*** Testing DateTime::setTime() : 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