• # calc. working hours in vb.net

hi all
could any one tell me how to calc working hours of a particular week please see below example

start time out time
monday 9:00 6:00
tue 9:10 5:00
wed 9:15 4:30
thurs 9:00 5:00
fri 9:00 6:45
sat 9:00 6:00

total working hours ________?_
could any one help me to find out total hours of Out time of above days
that will be a great help for me
Thanks
• Hi

you add one more column working hours..if you are out, (outtime) you calculate the working hours using the following

Dim t1, t2 As DateTime
t1 = starttime
t2 = endtime
Dim d1 As System.TimeSpan
d1 = t2.Subtract(t1)
MsgBox(d1.Totalhours)

stored into one more column and calculate total working hours.
more detail take a look
http://articles.techrepublic.com.com/5100-3513_11-5760752.html

Kavitha

Regards
NK

• Hi
you calculate working hours

Dim t1, t2 As DateTime
t1 = "11/22/2006 08:30:00 AM"
t2 = DateTime.Now
Dim d1 As System.TimeSpan
d1 = t2.Subtract(t1)
MsgBox(d1.Totalhours)
msgbox(d1.TotalMinutes)

starttime and outtime are must date field.

Regards
NK

• let us suppose u have 3 columns in the table Timings: CREATE TABLE TIMINGS (EMPID NUMERIC(9),starttime datetime,endtime datetime ) insert into timings values(1,'12/12/2006 9:18:06','12/12/2006 20:15:01') insert into timings values(1,'12/13/2006 9:15:06','12/13/2006 19:13:04') insert into timings values(1,'12/14/2006 9:13:06','12/14/2006 20:12:01') insert into timings values(1,'12/15/2006 9:11:06','12/15/2006 20:15:01') Then u will get: select empid,sum(convert(numeric(10,5),datediff(ss,starttime,endtime))/3600) 'Total Hrs' from timings group by empid