我正在嘗試做start_time + appt_duration = end_time; START_TIME爲e:G:8時00分00秒的持續時間 E:G:01:30:00如何在PHP中添加時間值?
但結束時間與未來:0時54分08秒
所有屬性被配置 '時間'在數據庫中。
代碼:
$time= $model->start_time;
$duration=$model->appt_duration;
$duration_array = explode(':', $duration);
$length = ((int)$duration_array[0] * 3600) + ((int)$duration_array[1] * 60) + (int)$duration_array[2];
$target = $length + $time;
$model->end_time= $target;
可能重複的[在PHP中計算時間(加10小時)?](http://stackoverflow.com/questions/1665702/time-calculation-in-php-add-10-hours) –