-1

I have a two days i want to get number of days between these two dates

$a = 25:10:2018 04:10 AM;
$b = 26:10:2018 04:10 PM;

My expected result is:

$result = 1.5 days;

calculate based on time

Jothees P
  • 11
  • 5

1 Answers1

-1

I cannot add a comment but heres my 2 cents, $a = ('YYYY-MM-DD'); $b = ('YYYY-MM-DD'); $d1 = new DateTime($a); $d2 = new DateTime($b);

$result = $d1->diff($d2);

//put your format in date format
$diff = $result->format("%D %H:%i:%s");

Hope this works for you...

A. Kiyoshi
  • 61
  • 1
  • 13