convert seconds into hh:mm:ss

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am setting up a report. In this report, I have a field that is populated
from a query with the average seconds that a person is on a phone call. I'm
trying to get the numbers to calculate to the HH:MM:SS format.
 
I am sure I understand. If you want the differance between 2 time use
DateDiff("s", date1, date2). This will give you the differance in seconds
between the 2 times.

If you already have the differance and want to format a time out to the
seconds then for format(time,"hh:mm:ss") or format(time,"Long Time").

Dale
 
To convert Seconds into Hours:Minutes:Seconds, try this formula. The
formatting will give a minimum of 2 digits for each part.

Format([Seconds]\3600, "00") & ":" & Format(([Seconds]-
([Seconds]\3600)*3600)\60, "00") & ":" & Format(([Seconds] Mod
3600)-(([Seconds]- ([Seconds]\3600)*3600)\60)*60, "00")

Replace "Seconds" with the name of the field that holds the seconds. The "\"
is integer division. The parentheses are needed because it isn't done in the
order of normal division.
 
Dmackcwby said:
I am setting up a report. In this report, I have a field that is populated
from a query with the average seconds that a person is on a phone call. I'm
trying to get the numbers to calculate to the HH:MM:SS format.

Format([YourSecondsField]/86400, "hh:mm:ss")

86400 is the number of seconds in a day (24*60*60.)

-Greg.
 
Thanks Greg, I knew there had to be a simpler formula.

--
Wayne Morgan
MS Access MVP


Gregory Paret said:
Dmackcwby said:
I am setting up a report. In this report, I have a field that is
populated from a query with the average seconds that a person is on a
phone call. I'm trying to get the numbers to calculate to the HH:MM:SS
format.

Format([YourSecondsField]/86400, "hh:mm:ss")

86400 is the number of seconds in a day (24*60*60.)

-Greg.
 
Back
Top