1--TEST-- 2Test for DateTime::modify() with absolute time statements 3--INI-- 4date.timezone=Europe/London 5--FILE-- 6<?php 7$tests = array( 8 '2010-12-15 19:42:45 UTC' => array( 9 'october 23:00', // October 23rd, with a broken time 10 'back of 4pm', 11 'next week monday', 12 'next week monday 10am', 13 'tuesday noon', 14 'first monday of January 2011', 15 'first monday of January 2011 09:00', 16 ), 17 '2010-12-15 19:42:45' => array( 18 'october 23:00', // October 23rd, with a broken time 19 'march 28, 00:15', 20 'march 28, 01:15', // doesn't exist because of DST 21 'march 28, 02:15', 22 ), 23); 24 25foreach ( $tests as $start => $data ) 26{ 27 foreach ( $data as $test ) 28 { 29 echo date_create( $start ) 30 ->modify( $test ) 31 ->format( DateTime::RFC2822 ), "\n"; 32 } 33} 34echo "\n"; 35?> 36--EXPECT-- 37Fri, 15 Oct 2010 23:00:00 +0000 38Wed, 15 Dec 2010 16:15:00 +0000 39Mon, 20 Dec 2010 00:00:00 +0000 40Mon, 20 Dec 2010 10:00:00 +0000 41Tue, 21 Dec 2010 12:00:00 +0000 42Mon, 03 Jan 2011 00:00:00 +0000 43Mon, 03 Jan 2011 09:00:00 +0000 44Fri, 15 Oct 2010 23:00:00 +0100 45Sun, 28 Mar 2010 00:15:00 +0000 46Sun, 28 Mar 2010 02:15:00 +0100 47Sun, 28 Mar 2010 02:15:00 +0100 48