Forums » .NET » .NET »

calc. working hours in vb.net


Posted Date: 13 Dec 2006      Posted By:: Simran     Member Level: Bronze    Member Rank: 0     Points: 2   Responses: 3



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




Responses

#100151    Author: Kavitha      Member Level: Gold      Member Rank: 211     Date: 13/Dec/2006   Rating: 2 out of 52 out of 5     Points: 2

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


 
#100152    Author: Kavitha      Member Level: Gold      Member Rank: 211     Date: 13/Dec/2006   Rating: 2 out of 52 out of 5     Points: 2

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


 
#100217    Author: Sriman N Vangala      Member Level: Gold      Member Rank: 116     Date: 14/Dec/2006   Rating: 2 out of 52 out of 5     Points: 2

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




 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India