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--SKIPIF--
10<?php if (!method_exists('DateInterval', 'format')) die("skip: method doesn't exist"); ?>
11--FILE--
12<?php
13date_default_timezone_set('UTC');
14
15$date1 = new DateTime('2000-01-01 00:00:00');
16$date2 = new DateTime('2001-03-04 04:05:06');
17
18$interval = $date1->diff($date2);
19
20echo $interval->format('Y=%Y') . "\n";
21echo $interval->format('M=%M') . "\n";
22echo $interval->format('D=%D') . "\n";
23echo $interval->format('H=%H') . "\n";
24echo $interval->format('I=%I') . "\n";
25echo $interval->format('S=%S') . "\n";
26echo $interval->format('R=%R') . "\n";
27
28echo $interval->format('y=%y') . "\n";
29echo $interval->format('m=%m') . "\n";
30echo $interval->format('d=%d') . "\n";
31echo $interval->format('h=%h') . "\n";
32echo $interval->format('i=%i') . "\n";
33echo $interval->format('s=%s') . "\n";
34echo $interval->format('r=%r') . "\n";
35
36echo "\n";
37
38$interval = $date2->diff($date1);
39
40echo $interval->format('inverted R=%R') . "\n";
41echo $interval->format('inverted r=%r') . "\n";
42
43echo "\n";
44
45echo $interval->format('%=%%') . "\n";
46
47// Invalid valid format character does not raise warnings.
48echo $interval->format('x=%x') . "\n";
49
50?>
51--EXPECT--
52Y=01
53M=02
54D=03
55H=04
56I=05
57S=06
58R=+
59y=1
60m=2
61d=3
62h=4
63i=5
64s=6
65r=
66
67inverted R=-
68inverted r=-
69
70%=%
71x=%x
72