How can DateTime::add() be used to add only 1 hour accurately?

When using DateTime::add() to add 1 hour, we need to be careful as adding a fixed number of hours may not always be accurate due to daylight saving time changes or leap years. To accurately add 1 hour, we can use the DateInterval class to specify the exact interval of 1 hour. This ensures that the addition is precise and takes into account any time changes that may affect the result.

$date = new DateTime();
$date->add(new DateInterval('PT1H'));
echo $date->format('Y-m-d H:i:s');