Calculate minutes to hh:mm

artanis50

New member
Local time
Yesterday, 18:44
Joined
Dec 22, 2011
Messages
6
Hello, Any help I can get on this issue is greatly appreciated.

I have a table that has a field name "duration". For each record, it shows the duration of surgery in minutes. Ultimately, I need to convert this to hh:mm, but with hours in one column and minutes in another.

I have tried using
Format([duration],["hh:nn"])

But I get a syntax error. What am I doing wrong?
 
Ultimately, I need to convert this to hh:mm, but with hours in one column and minutes in another.

This would be a query to do that:

SELECT Int([duration]/60) AS DurationHours, ([duration] Mod 60) AS DurationMinutes FROM YourTableNameHere;


Change YourTableNameHere to the name of the table [duration] is in. You can bring in the duration field itself to verify its doing it correctly.
 
You can do it in ONE field in the query if you wanted to just display the whole time instead of doing separate fields:

Select Format([duration]\60, "00") & ":" & Format([duration] Mod 60, "00") As DurationHours.


By the way Plog - if you use the backwards slash for dividing it gives you an Integer without the decimal, so you don't need the INT or CInt functions.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom