I'm using php 8. I have a DateTimeImmutable
object in timezone "Europe/Zurich"
$start = new DateTimeImmutable('2021-03-28 01:00', new DateTimeZone("Europe/Zurich"));
// Europe/Zurich is in UTC+1 during winter, UTC+2 in summer
Then I add 1, resp. 2 hours using DateInterval
$oneHour = $start->add(new DateInterval('PT1H'));
$twoHour = $start->add(new DateInterval('PT2H'));
echo $oneHour->format('c');
echo $twoHour->format('c');
What i expect:
"2021-03-28T03:00:00+02:00"
"2021-03-28T04:00:00+02:00"
What i get:
"2021-03-28T03:00:00+02:00"
"2021-03-28T03:00:00+02:00" <-- same result!
Is this a php bug? Why does it fail? Is it expected behaviour?