1--TEST-- 2Bug #50555 (DateTime::sub() allows 'relative' time modifications). 3--FILE-- 4<?php 5$now = '2010-03-07 13:21:38 UTC'; 6//positive DateInterval 7$da1 = date_create( $now ); 8$ds1 = date_create( $now ); 9$i = DateInterval::createFromDateString('third Tuesday of next month'); 10echo $da1->format( DateTime::ISO8601 ), "\n"; 11echo date_add($da1, $i)->format( DateTime::ISO8601 ), "\n"; 12date_sub($ds1, $i); 13 14//negative DateInterval 15$da2 = date_create( $now ); 16$ds2 = date_create( $now ); 17$i2 = DateInterval::createFromDateString('third Tuesday of last month'); 18echo $da2->format( DateTime::ISO8601 ), "\n"; 19echo date_add($da2, $i2)->format( DateTime::ISO8601 ), "\n";//works 20date_sub($ds2, $i); 21?> 22--EXPECTF-- 232010-03-07T13:21:38+0000 242010-04-20T13:21:38+0000 25 26Warning: date_sub(): Only non-special relative time specifications are supported for subtraction in %sbug50055.php on line 9 272010-03-07T13:21:38+0000 282010-02-16T13:21:38+0000 29 30Warning: date_sub(): Only non-special relative time specifications are supported for subtraction in %sbug50055.php on line 17 31