I have a field in a report which displays a value by total seconds ie 1827 seconds. I would like to convert this value into a new field shown as HH:MM:SS.
Does anyone have any ideas on how i can achieve this.
All help appreciated.
Cheers
Arry:D
pdx_man
10-31-2003, 12:37 PM
Well there are 60 seconds in a minute and 60 minutes in an hour ...
Format(Int([Field1]/3600),"00") & ":" & Format(Int(([Field1]-(Int([Field1]/3600)*3600))/60),"00") & ":" & Format((([Field1] Mod 60)),"00")
Fornatian
10-31-2003, 12:50 PM
would:
Format(([YourField]/3600),"hh:nn:ss") be as effective?
pdx_man
10-31-2003, 01:03 PM
Trying that, Fornation, I get:
12:10:48
and seeing yours, I see that I dropped a zero in my formula. :D
Ah, and I see why. 1827 / 3600 yields .5075. So Access is returning .5075ths of a day, or just over 12 hours. So then, we see that we have 86400 seconds in a day. So we modify Fornation's formula to give us:
Format(([Field1]/86400),"hh:nn:ss")
I like that a lot better.
Fornatian
11-01-2003, 06:29 AM
I knew I was out somewhere, multiplying 3600 x 24hours is what I was actually getting at. Nice one PDX.
Thanks for all your help guys. That is great!!!!
I am using the formula as per above but when the seconds equal over 24 hours a day is dropped. How can i get this field to show the tot HH:MM:SS and not just the HH:MM:SS of the "current day".
I.e 86412 Seconds should equal 24:00:12 but shows as 00:00:12.
All help appreciated.
namliam
11-11-2003, 04:09 AM
Originally posted by pdx_man
Well there are 60 seconds in a minute and 60 minutes in an hour ...
Format(Int([Field1]/3600),"00") & ":" & Format(Int(([Field1]-(Int([Field1]/3600)*3600))/60),"00") & ":" & Format((([Field1] Mod 60)),"00") use something like above....
misscrf
03-17-2008, 08:55 AM
Hey, I was searching for this syntax and just thought I would post a thank you.
pdx_man
03-24-2008, 01:28 PM
Sure thing. It is always nice to see that our efforts are appreciated.