I need to convert seconds in the format 3d, 02:05:45
. With the below function I could convert it to 3.02:05:45
. I'm not sure how to convert it to the format I wanted. Please help.
private string ConvertSecondsToDate(string seconds)
{
TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(seconds));
if (t.Days > 0)
return t.ToString(@"d\.hh\:mm\:ss");
return t.ToString(@"hh\:mm\:ss");
}
If I try to do something like this return t.ToString(@"%d , hh\:mm\:ss")
I'm getting an error,
input string is not in correct format.