add time to date in php code example
Example 1: add 1 day php datetime
$date = new DateTime('2000-01-01');
$date->add(new DateInterval('P1D'));
Example 2: add seconds to datetime php
<?php
$date = new DateTime();
echo $date->getTimestamp(). "<br>";
$date->add(new DateInterval('PT674165S'));
echo $date->getTimestamp();
?>
Example 3: add hour minute in datetime in php
$minutes_to_add = 5;
$time = new DateTime('2011-11-17 05:05');
$time->add(new DateInterval('PT' . $minutes_to_add . 'M'));
$stamp = $time->format('Y-m-d H:i');