This function accepts minutes as parameter and give time output after adding it to current time.
Function
function addMinutes($minutes_to_add) {
$time = new DateTime(date('Y-m-d H:i:s', time()));
$time->add(new DateInterval('PT' . $minutes_to_add . 'M'));
return $stamp = $time->format('Y-m-d H:i');
}
Calling The Function
Current date time at the time of test was 2018-06-04 01:10 echo addMinutes(20);
Output
2018-06-04 01:30

Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *