1--TEST--
2RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd1)
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 * Backward Transitions, diff().
14 */
15
16$end   = new DateTime('2010-11-07 05:30:00');
17$start = new DateTime('2010-11-06 04:30:00');
18echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
19	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
20
21$end   = new DateTime('2010-11-07 04:30:00');
22$start = new DateTime('2010-11-06 04:30:00');
23echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
24	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
25
26$end   = new DateTime('2010-11-07 03:30:00');
27$start = new DateTime('2010-11-06 04:30:00');
28echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
29	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
30
31$end   = new DateTime('2010-11-07 02:30:00');
32$start = new DateTime('2010-11-06 04:30:00');
33echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
34	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
35
36$end   = new DateTime('2010-11-07 01:30:00');
37$start = new DateTime('2010-11-06 01:30:00');
38echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format)
39	. ' = ' . $start->diff($end)->format($interval_format) . "\n";
40
41echo "\n";
42?>
43--EXPECT--
44bd1 2010-11-07 05:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT1H
45bd2 2010-11-07 04:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P1DT0H
46bd3 2010-11-07 03:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT24H
47bd4 2010-11-07 02:30:00 EST America/New_York - 2010-11-06 04:30:00 EDT America/New_York = P0DT23H
48bd7 2010-11-07 01:30:00 EDT America/New_York - 2010-11-06 01:30:00 EDT America/New_York = P1DT0H
49