[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

How to determine the time 'amount' between two times?

Hi,

I have a table which contains time management data. We have:

R = Registration
A = Arrival
D = Departure

Time information for A and D can be in the table multiple times for one of our employees. What I would like to do is show the amount of time between the R and the last D of the day.

So R = 08:00 and the last D = 18:30 so the time amount would be 10 hours and 30 minutes.

Is there any way to do this in MySQL?

Regards

Ken
0
kenuk110
Asked:
kenuk110
1 Solution
 
fcardinauxCommented:
You may use the timediff() function:

SELECT MAX(TIMEDIFF(D, R)) FROM thetable WHERE condition

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
0
 
kenuk110Author Commented:
Worked perfectly.

Thank you.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now