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