Nirmal KumarC

Nirmal KumarC

  • 1.4k
  • 327
  • 79.1k

How to calculate Time Format data in sql?

Oct 20 2014 7:18 AM
My Table Below Record Overtime_HHMM column only sum Total time in (time format)


Table Structure is 
Overtime_HHMM  time(7)

ProcessDate    Overtime_HHMM
04 Mar 2014    02:59:00.0000000
05 Mar 2014    01:58:00.0000000
06 Mar 2014    01:18:00.0000000
07 Mar 2014    04:08:00.0000000
12 Mar 2014    00:39:00.0000000
13 Mar 2014    00:22:00.0000000
17 Mar 2014    02:01:00.0000000
22 Mar 2014    00:36:00.0000000
I want This Overtime_HHMM total is :14:01:00:0000000

My Query is
select sum(datediff(minute,'0:00:00',CONVERT(time,Overtime_HHMM)))/60.0 as TotalHoursWorked from Accounts_DailyAttendance where UserID='1050' and datename(month,processdate) ='March' and datepart(yyyy,processdate)= '2014' and LateIn > 5

Answers (1)