You must Sign In to post a response.
  • Category: .NET

    calc. working hours in

    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
  • #100151

    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)

    stored into one more column and calculate total working hours.
    more detail take a look



  • #100152
    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)

    starttime and outtime are must date field.


  • #100217
    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

  • 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.