conversion of seconds to other formats in MSAccess

J

jp-aib

Hi

I have a problem with a field in a query, i have a number field, which
represents a value in seconds from midnight, and i need to convert this value
to time in the format hh:mm:ss

I can do it in excel using the function

=CONVERT(A1,"sec","day") (where A1 contains the value) and then formating
the field in custom hh:mm:ss

but the same function doesnt work on the output in msaccess.

any ideas?

thanks
James
 
P

Pieter Wijnen

there are 24*60*60 = 86400 seconds in a day
As Access stores time as a fraction of a day the calculation is:
ShowTime : CDate([SecondField]/86400)

HtH

Pieter
 
A

Anthos

If I read the post correctly, you already have the value in seconds,
past midnight, and need to convert that into hh:mm:ss?
If that is the case, then this would work for you.

Format(dateadd("s", 4339, #00:00:00#), "hh:mm:ss")

Hope our answers helped you,

Kind Regards,
Anthony Moore
 
J

jp-aib

Thanks for your help with that Pieter, worked perfectly..
regards
James

Pieter Wijnen said:
there are 24*60*60 = 86400 seconds in a day
As Access stores time as a fraction of a day the calculation is:
ShowTime : CDate([SecondField]/86400)

HtH

Pieter

jp-aib said:
Hi

I have a problem with a field in a query, i have a number field, which
represents a value in seconds from midnight, and i need to convert this
value
to time in the format hh:mm:ss

I can do it in excel using the function

=CONVERT(A1,"sec","day") (where A1 contains the value) and then formating
the field in custom hh:mm:ss

but the same function doesnt work on the output in msaccess.

any ideas?

thanks
James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top