Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
deejaygeekout
Starting Member
1 Post |
Posted - 2011-06-19 : 03:29:57
|
| Overview: Im trying to make a TIME-IN-OUT program that will compute the total number of hours worked in every employee.PROBLEM 1:Suggestion please how can I get the total number of hours from time in and out. The employee will click the button, and it will save it as TIME INthen for the second attempt it will be the TIME OUT. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-06-19 : 08:26:29
|
You can use the datediff function to calculate the duration. For example:select datediff(mi,TIMEIN,TIMEOUT)/60.0 will give you the number of hours worked including fractional parts. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-06-20 : 10:38:21
|
| Just for readability, I would useselect datediff(minute,TIMEIN,TIMEOUT)/60.0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|