the value in variables is "13 minutes 34 seconds", "14 seconds", "5 minutes 26 seconds"
how do i count the total amount of time php javascript
the value in variables is "13 minutes 34 seconds", "14 seconds", "5 minutes 26 seconds"
how do i count the total amount of time php javascript
$DATE_1 = new DateTime('NOW'); $DATE_2 = clone $DATE_1; $ARRAY = [ "13 minutes 34 seconds", "12 seconds", "5 minutes 26 seconds" ]; foreach ($ARRAY as $value) { $DATE_2->modify($value); } $DIFF = date_diff($DATE_1, $DATE_2); var_dump($DIFF); $DIFF work with $DIFF .
DateInterval with English chtol too bad? php.net/manual/ru/class.dateinterval.php - documentation. If you need the total number of seconds, then: var_dump($DIFF) change to: var_dump($DATE_2->getTimestamp() - $DATE_1->getTimestamp()) - ManitikylGoogle gives this answer
time = 06: 58: 00, time2 = 00: 40: 00, result = 07:38:00
$time = "06:58:00"; $time2 = "00:40:00"; $secs = strtotime($time2)-strtotime("00:00:00"); $result = date("H:i:s",strtotime($time)+$secs); Source: https://ru.stackoverflow.com/questions/840890/
All Articles