1--TEST-- 2Bug #55253 (DateTime::add() and sub() result -1 hour on objects with time zone type 2) 3--CREDITS-- 4Daniel Convissor <danielc@php.net> 5--FILE-- 6<?php 7 8date_default_timezone_set('America/New_York'); 9 10$interval = new DateInterval('PT2H1M'); 11 12$date3 = new DateTime('2010-10-04 02:18:48'); 13$date2 = new DateTime('2010-10-04 02:18:48 EDT'); 14 15echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n"; 16echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n"; 17 18echo $interval->format('Add %h hours %i minutes') . "\n"; 19$date3->add($interval); 20$date2->add($interval); 21 22echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n"; 23echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n"; 24 25// Try subtracting from expected result. 26$date3 = new DateTime('2010-10-04 04:19:48'); 27$date2 = new DateTime('2010-10-04 04:19:48 EDT'); 28 29echo $interval->format('Subtract %h hours %i minutes from expected') . "\n"; 30$date3->sub($interval); 31$date2->sub($interval); 32 33echo 'Zone Type 3: ' . $date3->format('Y-m-d H:i:s T') . "\n"; 34echo 'Zone Type 2: ' . $date2->format('Y-m-d H:i:s T') . "\n"; 35 36?> 37--EXPECT-- 38Zone Type 3: 2010-10-04 02:18:48 EDT 39Zone Type 2: 2010-10-04 02:18:48 EDT 40Add 2 hours 1 minutes 41Zone Type 3: 2010-10-04 04:19:48 EDT 42Zone Type 2: 2010-10-04 04:19:48 EDT 43Subtract 2 hours 1 minutes from expected 44Zone Type 3: 2010-10-04 02:18:48 EDT 45Zone Type 2: 2010-10-04 02:18:48 EDT 46