0

I need to know if a timestamp is 20 seconds smaller than now, I tried this code, but with this, I only know what date is bigger.

$a= new DateTime("1901-03-12");
$b= new DateTime("2000-04-11");

$res = ($a > $b) ? "mayor" : (($a < $b) ? "menor" : "igual");

echo $res

What con I do to know if there are 20 seconds of difference between two timestamps?

0 Answers0