Home / PHP Tips Generated By ChatGPT / Working with Date Intervals in PHP Add or subtract dates using DateInterval with a DateTime object. Source Code $date = new DateTime('now'); $date->add(new DateInterval('P10D')); // Adds 10 days echo $date->format('Y-m-d');