22:03:00.0000000
My C# Code is below
private void LoadOvertimetotal()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
string str = "SELECT total_sec = SUM(( DATEPART(hh, Overtime_HHMM) * 3600 ) +( DATEPART(mi, Overtime_HHMM) * 60 ) + DATEPART(ss, Overtime_HHMM)) FROM Accounts_DailyAttendance where UserID='" + gvStaffDetails.SelectedRow.Cells[2].Text.ToString().Trim() + "' and datename(month,processdate) ='" + Session["paymonth"] + "' and datepart(yyyy,processdate)='" + Session["payyear"] + "' and Overtime_HHMM<>'00:00:00.0000000'";
string strtotminutes = "SELECT totalovertime = CONVERT(TIME, DATEADD(s, total_sec, 0))FROM Accounts_DailyAttendance";
cmd = new SqlCommand(str, con);
cmd = new SqlCommand(strtotminutes, con);
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
lbltotalovertime.Text = reader["totalovertime"].ToString();
reader.Close();
con.Close();
}
Thanks