Answers for "php count second different"

PHP
0

php count second different

<?php

$hour1 = '12:00:00';
$hour2 = '09:00:00';

$o1 = new DateTime($hour1);
$o2 = new DateTime($hour2);

$diff = $o1->diff($o2,true); // to make the difference to be always positive.

echo $diff->format('%H:%I:%S');
Posted by: Guest on September-28-2021

Browse Popular Code Answers by Language