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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL database about password and DATE

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 IN
then 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.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-06-20 : 10:38:21
Just for readability, I would use

select datediff(minute,TIMEIN,TIMEOUT)/60.0

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -