1--TEST-- 2DateInterval::format(), except %a 3--DESCRIPTION-- 4%a is covered in a separate test. 5Don't want an XFAIL here to cause confusion if a real bug comes up. 6--CREDITS-- 7Daniel Convissor <danielc@php.net> 8# TestFest 2010 BKTK 9--FILE-- 10<?php 11date_default_timezone_set('UTC'); 12 13$date1 = new DateTime('2000-01-01 00:00:00'); 14$date2 = new DateTime('2001-03-04 04:05:06'); 15 16$interval = $date1->diff($date2); 17 18echo $interval->format('Y=%Y') . "\n"; 19echo $interval->format('M=%M') . "\n"; 20echo $interval->format('D=%D') . "\n"; 21echo $interval->format('H=%H') . "\n"; 22echo $interval->format('I=%I') . "\n"; 23echo $interval->format('S=%S') . "\n"; 24echo $interval->format('R=%R') . "\n"; 25 26echo $interval->format('y=%y') . "\n"; 27echo $interval->format('m=%m') . "\n"; 28echo $interval->format('d=%d') . "\n"; 29echo $interval->format('h=%h') . "\n"; 30echo $interval->format('i=%i') . "\n"; 31echo $interval->format('s=%s') . "\n"; 32echo $interval->format('r=%r') . "\n"; 33 34echo "\n"; 35 36$interval = $date2->diff($date1); 37 38echo $interval->format('inverted R=%R') . "\n"; 39echo $interval->format('inverted r=%r') . "\n"; 40 41echo "\n"; 42 43echo $interval->format('%=%%') . "\n"; 44 45// Invalid valid format character does not raise warnings. 46echo $interval->format('x=%x') . "\n"; 47 48?> 49--EXPECT-- 50Y=01 51M=02 52D=03 53H=04 54I=05 55S=06 56R=+ 57y=1 58m=2 59d=3 60h=4 61i=5 62s=6 63r= 64 65inverted R=- 66inverted r=- 67 68%=% 69x=%x 70