$now = new DateTime(); $now->add(new DateInterval('P1D'));
$date = new DateTime('2021-10-01 12:00:00'); $date->add(new DateInterval('PT3H30M'));In this example, we created a new DateTime object with a specific datetime, and added a DateInterval of 3 hours and 30 minutes to it using the add method. The DateTime add method is a core PHP function, and it is part of the DateTime class. Therefore, no additional package or library is required to use it.