-2

I have a report I built but the problem is the subtract time in the database.

as

$intime= "02:00:00";
$outtime= "03:25:50";

Output will be 01:25:50

So my question is how can I take an action in PHP (string of mysql format time)

Shrikant Mavlankar
  • 1,145
  • 1
  • 8
  • 17
AR Bhuiyan
  • 21
  • 1
  • 7

1 Answers1

0

You can do this using PHP's DateTime class:

$a = new DateTime('02:00:00');
$b = new DateTime('03:25:50');
echo $a->diff($b)->format("%H:%I:%S");  // 01:25:50
trincot
  • 317,000
  • 35
  • 244
  • 286