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?
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?
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);
-strtotime("00:00:00")
? - VesperThe 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
Source: https://ru.stackoverflow.com/questions/437355/
All Articles