Solution 1
"ddD:hhH:mmM:ssS"
is invalid and will not work. There is some default formatting that might do it for you, but if that will not work, then you can use some of the properties to create whatever format you want. A sample is as follows:
public string Duration
{
get
{
TimeSpan timeSpan = TimeSpan.FromSeconds(_seconds);
return String.Format("{0:00}D:{1:00}H:{2:00}M:{3:00}S", timeSpan.Days, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
}
}
private int _seconds;
See
http://msdn.microsoft.com/en-us/library/ee372286.aspx[
^] for details. Unfortunately, there is no way to simplify custom formating with TimeSpans.
I have updated the answer with the letters.