Convert Number to Time format

K

Krish

In a Mutivalue database, time is stored as a number like "27108"
representing the number of seconds since midnight.I would like to convert
the number into Hrs:min in Access query using a formula. Any help is
appreciated.

Krish
 
A

Allen Browne

If you are sure the number of seconds won't wrap past 24 hours, you could
use DateAdd() like this:
DateAdd("s", [Seconds], #0:00:00#)

This alternative gives a text result (not suitable for performing math on):
(Seconds] \ 60) \ 60 & Format(([Seconds] \ 60) Mod 60, "\:00")

Explanation of the integer division and Mod operator in:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html
 

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