SQL Conversion Time to Decimal

APD Toronto
APD Toronto used Ask the Experts™
Hello Experts,

I have a time field, set to Date/Time with input mask 00:00;0;_

The field accepts values like 8:48, 10:45 and 16:11 and I'm wondering if i can convert these do decimal using a SQL Query?

for example, if i were using vb to convert i would use the folwing logic:

hr = anything before the colon
min = anything after the ccolon

result = hr + (min / 60)
so 8:48 = 8.8
   10:45 = 10.75
   16:11 = 16.18333

Is this possible in SQL Query?

Thank you.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

datepart("h",yourtime) + datepart("m",yourtime)/60 + datepart("s",yourtime)/3600
Top Expert 2010
Assuming this is Access...

SELECT TimeColumn, TimeValue([TimeColumn]) * 24
FROM SomeTable

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial