There are two variables:

$first = "13:00"; $second = "00:25"; $new_date = date('H:i', strtotime("+$second minuts", strtotime($first))); // Не работает!( 

how to fold them to make 13:25?

  • Add as dates? From both you make dates, and it is better from one date, from the second timespan (if it is found in PHP), and you add them, then export them to a string of the correct format. - Vesper

2 answers 2

Here is the expression gives the correct answer. More details can be found here http://php.ru/forum/viewtopic.php?t=45167

 $res = strtotime('13:00') + strtotime('00:25') -strtotime("00:00:00"); echo date('H:i',$res); 
  • Backfill question: Why is the last one- -strtotime("00:00:00") ? - Vesper
  • one
    Subtract today's date to get only time. Specially cited the link where it is already written. - Alex Samborskiy

The second argument of strtotime should not be a string, but a timestamp. And the hours and minutes will have to be shared by yourself.

 $first = "13:10"; $second = "00:25"; list($h, $m) = explode(':', $first); echo $new_date = date('H:i', strtotime("+$h hour $m minute", strtotime($second))); // 13:35