0

I am trying to compare and find difference between two timestamps. So, this is what I have done.

    $add_time = config('constant.time'); //Adding 5 minutes
    $time = date("Y-m-d H:i:s", strtotime($approval->updated_at . '+'.$add_time.' minutes')); //2018-06-09 06:11:13

    $now  = date("Y-m-d H:i:s"); // //2018-06-09 06:42:27


    if($now > $time)
    {
     print_r("Time working")
    }else {
           print_r("Not Working")
          }

    $diff = $now - $time; //Throws Error

So, this comparison is working for me. But, when I try to find the difference between these two times, I get an error saying

"A non well formed numeric value encountered"

How can I find the difference between these two timestamps?

Rob13
  • 381
  • 8
  • 20

0 Answers0