add hours:min:sec to date in PHP
问题 I am trying to add hh:mm:ss with the date. How can i do it? I tried with the following but it works when the hour is string, but when adding time is similar to MySQL Date time it is not working. $new_time = date("Y-m-d H:i:s", strtotime('+5 hours')); I am trying to get solution for the following: $timeA= '2015-10-09 13:40:14'; $timeB = '03:05:01'; // '0000-00-00 03:05:01' OutPut: $timeA + $timeB = 2015-10-09 16:45:15 ? How Can I Add this? 回答1: Use DateInterval(): $timeA = new DateTime('2015