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

Change time into Number in SQL or Access

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I am doing some VB stuff with MS Access as back-end. I was working on the project which will keep track of the number of hours students work in a day and the expense for the same. Now, i have got the time they begin their work and the time they end their work. I have found the difference (e.g. 3.30 hours). But now how do i change the same in to numeric value as in 3.5 hours??? (either in SQL or Access). I am asking for SQL since in VB I am using SELECT statements to get the Access queries. Also, how do i format them to limit it to 2 decimal places (in SQL)?

I would appreciate a quick response
Thanks in anticipation
Ketan Shah
 
datediff(minute,field1,field2)/60.0

round appropriatly.

You need to do minutes instead of hours and divide by 60.0 not 60 or sql will convert the answer to an integer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top