What are the potential pitfalls of calculating time differences in PHP, especially when dealing with Daylight Saving Time changes?

When calculating time differences in PHP, especially when dealing with Daylight Saving Time changes, a potential pitfall is not accounting for the changes in time offset. To solve this issue, it's important to use timezone-aware functions like `DateTime` and `DateTimeZone` to accurately calculate time differences while considering Daylight Saving Time adjustments.

$date1 = new DateTime('2023-03-12 00:00:00', new DateTimeZone('America/New_York'));
$date2 = new DateTime('2023-03-13 00:00:00', new DateTimeZone('America/New_York'));

$interval = $date1->diff($date2);

echo $interval->format('%R%a days %H hours %I minutes');