将时间和数字相加得到总数

Add together a time and a number to get a total

我有两次需要将两种不同格式的时间加在一起:

  1. 一个post时间'12:30'
  2. 用户提交的数字(表示持续时间)例如:1 = 小时,0.5 = 30 分钟

我需要将两者相加得到总数,例如:12:30 + 0.5 = 14:00.

我目前卡住了,缺少一些简单的东西,谁能给我指点一下?

代码:

// Get Post Time
$post_date = strtotime(get_the_date('G:i'));
// Get User Submitted Number
$post_duration = strtotime($course_hours);
// Add Together
$output = $post_date + $post_duration;
// Output
echo 'Start Time: '.get_the_date('G:i') .' - ';
// Fail Here
echo 'End Time: '. date('G:i', $output);
$add = 0.5 * 60 ; // convert posted hours to minutes 
$post_time = "12:30";
echo $post_date = date('G:i',strtotime("+ $add minutes" , strtotime($post_time)));