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

Convert a time to the decimal equivalent

Status
Not open for further replies.

okuser

Technical User
Oct 24, 2003
16
US
I need to know how to take and convert a time to the decimal equivalent. Example what I have as 8:30 needs to be 8.50. Can someone please help as I do not know where to begin?

Gayla
Newbie on CR8.5
 
Is this an actual time data type, or a string containing the time?

I'll assume the latter as most databases don't store a TIME type:

If val(mid({table.field},instr({table.time},":")+1) > 0 then
val(left({table.field},instr({table.time},":")-1)+
60/val(mid({table.field},instr({table.time},":")+1)
else
val(left({table.field},instr({table.time},":")-1)

Couldn't test right now, but that looks right.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top