TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nirmal KumarC
1.4k
327
79.1k
how to Convert integer value to time in c#
Oct 29 2014 2:54 AM
I have i time in Integer =
59400
, how can I convert it in C# to Timeformat
=
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
Reply
Answers (
3
)
how enable disable one checkbox not in group
namespace error