1--TEST--
2RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fd)
3--CREDITS--
4Daniel Convissor <danielc@php.net>
5--FILE--
6<?php
7
8date_default_timezone_set('America/New_York');
9$date_format = 'Y-m-d H:i:s T e';
10$interval_format = 'P%dDT%hH';
11
12/*
13 * Forward Transitions, diff().
14 */
15
16$end   = new DateTime('2010-03-14 03:00:00');
17$start = new DateTime('2010-03-14 01:59:59');
18echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
19	. ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n";
20
21$end   = new DateTime('2010-03-14 04:30:00');
22$start = new DateTime('2010-03-13 04:30:00');
23echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
24	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
25
26$end   = new DateTime('2010-03-14 03:30:00');
27$start = new DateTime('2010-03-13 04:30:00');
28echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
29	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
30
31$end   = new DateTime('2010-03-14 01:30:00');
32$start = new DateTime('2010-03-13 04:30:00');
33echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
34	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
35
36$end   = new DateTime('2010-03-14 01:30:00');
37$start = new DateTime('2010-03-13 01:30:00');
38echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
39	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
40
41$end   = new DateTime('2010-03-14 03:30:00');
42$start = new DateTime('2010-03-13 03:30:00');
43echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
44	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
45
46$end   = new DateTime('2010-03-14 03:30:00');
47$start = new DateTime('2010-03-13 02:30:00');
48echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
49	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
50?>
51--EXPECT--
52fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S
53fd2 2010-03-14 04:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P1DT0H
54fd3 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT22H
55fd4 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 04:30:00 EST America/New_York = P0DT21H
56fd5 2010-03-14 01:30:00 EST America/New_York - 2010-03-13 01:30:00 EST America/New_York = P1DT0H
57fd6 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 03:30:00 EST America/New_York = P1DT0H
58fd7 2010-03-14 03:30:00 EDT America/New_York - 2010-03-13 02:30:00 EST America/New_York = P1DT1H
59