-5

I am able to get the time difference between two times of the day. But I need part them. If somebody has crossed 8 hours time, the extra time he remains on the site will be added otherwise.

I calculated the time difference using my function:

dateDiff($intime,$outtime);

and got the output as 9 hours, 38 minutes, 30 seconds.

How do I find the duration exceeding 8 hours, 0 minutes, 0 seconds?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adwitya Media
  • 65
  • 1
  • 6

1 Answers1

2

Just Convert your results to the seconds like

(9 * 60 * 60 ) + (30 * 60) + 30 = total seconds

(8 * 60 * 60 ) = required seconds

difference = total seconds - required secods

difference will be in seconds, to convert it to hour

difference * 60 * 60 = diff in hours

IT ppl
  • 2,626
  • 1
  • 39
  • 56