Avatar of LillyC
LillyC
Flag for United Kingdom of Great Britain and Northern Ireland asked on

How to show hours and minutes in a query in MS Access

I just can't get this right grrrrrrr, I'm trying to show the number of hours and minutes, I can get the hours and the minutes separately but want to show as hours/minutes, eg 100 hours = 1 hour 40 minutes

Lateness Total Hours: (DateDiff('n',[Time due in],[Time arrived])/60)
Lateness Total Minutes: (DateDiff('n',[Time due in],[Time arrived]))
Lateness Total Hours/Minutes: (DateDiff('n',[Time due in],[Time arrived]))-(DateDiff('n',[Time due in],[Time arrived]))/60
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gustav Brock

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mark Edwards

This should give you the number of hours between in/out times:
Hours = DateDiff("h",[Datetimein],[datetimeout])
This should give you the leftover minutes after you subtract the full hours:
Minutes = DateDiff("n",[DatetimeIn],[datetimeOut])-((DateDiff("h",[DatetimeIn],[datetimeOut]))*60)

Works for me....
Mark Edwards

The above works if you want separate hours and minutes, or you could parse Gustav's solution results.
LillyC

ASKER
Superb - thank you both :)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Gustav Brock

You are welcome!