Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert seconds to minutes

Status
Not open for further replies.

baserath

Technical User
Jan 25, 2002
6
US
please help i need to convert data that is being stored in number of seconds to minutes the conversion is for a report.
Thanks for your help
 
The divide by 60 is understood. It is changing it from the decilam form on the minute to a form that reports it in the number of minutes and seconds 00:00. I know that 156 seconds is 2.6 minutes what I need reported is 2:36.
 
Oh, ok. Here's one way:
Code:
Public Function MinsAndSecs(Seconds As Long) As String
    Dim mins As Long, secs As Long

    mins = Int(Seconds / 60)
    secs = Seconds - (mins * 60)
    MinsAnd Secs = CStr(mins) & ":" & CStr(secs)
End Function
 Rick Sprague
 
Another way is to use the modulus operator or MOD in Access.

The seconds part of field = Seconds mod 60

Dim TheResult as string
dim Seconds as integer
Seconds = 156

TheResult = Int(Seconds/60) & ":" & (Seconds MOD 60)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top