1--TEST-- 2Test date_modify() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : DateTime date_modify ( DateTime $object , string $modify ) 6 * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). 7 * Source code: ext/date/php_date.c 8 * Alias to functions: public DateTime DateTime::modify() 9 */ 10 11 //Set the default time zone 12date_default_timezone_set("Europe/London"); 13 14echo "*** Testing date_modify() : basic functionality ***\n"; 15 16// Create a date object to modify 17$datetime = date_create("2009-01-31 14:28:41"); 18 19date_modify($datetime, "+1 day"); 20echo "After modification 1: " . date_format($datetime, "D, d M Y") . "\n"; 21 22date_modify($datetime, "+1 week 2 days 4 hours 2 seconds"); 23echo "After modification 2: " . date_format($datetime, "D, d M Y H:i:s") . "\n"; 24 25date_modify($datetime, "next Thursday"); 26echo "After modification 3: " . date_format($datetime, "D, d M Y") . "\n"; 27 28date_modify($datetime, "last Sunday"); 29echo "After modification 4: " . date_format($datetime, "D, d M Y") . "\n"; 30 31?> 32===DONE=== 33--EXPECTF-- 34*** Testing date_modify() : basic functionality *** 35After modification 1: Sun, 01 Feb 2009 36After modification 2: Tue, 10 Feb 2009 18:28:43 37After modification 3: Thu, 12 Feb 2009 38After modification 4: Sun, 08 Feb 2009 39===DONE=== 40