Sunday, October 11, 2015

Add Specific Minutes in DateTime PHP

date_default_timezone_set("asia/jakarta");
$minutes_to_add =1;
$time = new DateTime(date("Y-m-d H:i:s"));
$time->add(new DateInterval('PT' . $minutes_to_add . 'M'));
$stamp = $time->format('Y-m-d H:i:s');

No comments:

Post a Comment