Calculate time difference between two datetime in double digit hour,minutes and seconds format : <p>I am calculating time difference between two dates with format:</p>

<blockquote>
  <p>Hour:Minutes:Seconds</p>
</blockquote>

<p>Right now i am getting output like this with the following input:</p>

<pre><code>StartDate=2016-06-29 15:52:32.360

EndDate=2016-06-29 15:52:36.970

Output:  0 : 0 : 4
</code></pre>

<p>But i want to get double digit output in time :</p>

<pre><code>Expected Output: 00 : 00 : 04
</code></pre>

<p><strong>Input:</strong> </p>

<pre><code>StartDate=2016-06-29 15:52:32.360

EndDate=2016-06-29 15:53:36.970

Expected output: 00 : 01 : 04
</code></pre>

<p>This is my code:</p>

<pre><code>public class Attendance
{
      public int Id { get; set; }
      public Nullable&lt;System.DateTime&gt; StartDateTime { get; set; }
      public Nullable&lt;System.DateTime&gt; EndDateTime { get; set; }
}


var query = (from t in context.Attendance
             select new 
             {
             TotalTime =SqlFunctions.DateDiff("s",t.StartDateTime,t.EndDateTime) /3600 + " : "
            + SqlFunctions.DateDiff("s", t.StartDateTime, t.EndDateTime) % 3600 / 60
            + ": " + SqlFunctions.DateDiff("s", t.StartDateTime, t.EndDateTime) % 60,
              }).tolist();
</code></pre>

<p><strong>Note</strong>:I dont want to do like below:</p>

<pre><code>var query = (from t in context.Attendance.toList().
                  select new 
                  {
                     //code to calculate time difference and format time
                  }).tolist();
</code></pre>
