I'm trying to add 60 or 90 minutes to a given time using PHP.
I've tried doing this in two ways, both ending with an unexpected result.
Input data:
$data['massage_hour_from'] = '09:00:00';
$data['massage_duration'] = 60;
First try:
$data['massage_hour_to'] = date('H:i:s', strtotime('+' . $data['massage_duration'] . ' minutes', strtotime($data['massage_hour_from'])));
Second try:
$datetime = new DateTime($data['massage_date']);
$datetime->setTime($data['massage_hour_from']);
$datetime->modify('+' . $data['massage_duration'] .' minutes');
$data['massage_hour_to'] = $datetime->format('g:i:s');
What am I doing wrong?