Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,

I want to display Seconds as hh:nn:ss format in access report.
e.g. I have Seconds=92730, now I converted it as (92730/86400) and formated it in hh:nn:ss in report. But this displayed as 01:45:30. I want it as 25:45:30.

In Excel we have format as [h]:mm:ss but what is equavalent in access??

How to do this???
Please help me!!!
Posted

1 solution

You can't do it using Format() function, becouse it use 24 hours format.
You need to write custom function, like this:
VB
Function MyFormat(countOfSeconds As Long) As String
Dim h As Long, n As Long, s As Long

h = Fix(countOfSeconds / 3600) 'hours
n = Fix((countOfSeconds Mod 3600) / 60) 'minutes
s = countOfSeconds - ((h * 3600) + (n * 60)) 'seconds

MyFormat = h & ":" & n & ":" & s & ":"

End Function
 
Share this answer
 
Comments
Pravinkarne.31 21-Apr-12 6:57am    
Thank You!!!!
Maciej Los 21-Apr-12 14:05pm    
You're welcome ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900