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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert an integer to time

Status
Not open for further replies.

dmaier

MIS
Apr 13, 2002
38
US
Is there a way in a query to convert an integer to time. In otherwords 570 would be the integer and I would like to show 9:30 AM or 840 being the integer and showing 2:00 PM.

Thanks in advance for any help.
 
You would have to know what number indicates midnight, as in the 24 hour mark. Divide the current integer by the total integer, and use the date format, such as:

tMax={maximum time value}
tCur={current time}
tVal=tCur/tMax
tDis=format(tVal,"hh:mm")

 
Or DateAdd("n",570,0)

N being minutes, 527 of them, added to date 0

This yields 9:30 AM, 840 yields 2:00 PM. If you go past 24 hours, you get funky stuff of course, so don't do it this way if you ever do go past that.

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Chaz...

A further question...My field name from the table I am getting this from in my query is e_begin_date. How would I use this with the DateAdd function?
 
Hi.

in your query, you would put

MyAnswer: DateAdd("n",e_Begin_Date,0)

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top