Convert Seconds to HH:MM:SS

Ranjeet_8
Posted by Ranjeet_8 under ASP.NET category on | Points: 40 | Views : 1510

Int64 Yourseconds = 19800;
TimeSpan spanTM = new TimeSpan(TimeSpan.TicksPerSecond * Yourseconds);
string TimeStr = spanTM.Hours.ToString("00") + ":" + spanTM.Minutes.ToString("00") + ":" + spanTM.Seconds.ToString("00");
Response.Write(TimeStr);

Comments or Responses

Login to post response