title: Formatting timedelta objects
body: <p>I have two <code>datetime</code> objects. I need to calculate the <code>timedelta</code> between them and then show the output in a specific format.</p>
  
  <pre><code>Alpha_TimeObj = datetime.datetime(int(AlphaTime.strftime('%Y')), int(AlphaTime.strftime('%m')), int(AlphaTime.strftime('%d')), int(AlphaTime.strftime('%H')), int(AlphaTime.strftime('%M')), int(AlphaTime.strftime('%S')))
  Beta_TimeObj = datetime.datetime(int(BetaTime.strftime('%Y')), int(BetaTime.strftime('%m')), int(BetaTime.strftime('%d')), int(BetaTime.strftime('%H')), int(BetaTime.strftime('%M')), int(BetaTime.strftime('%S')))
  Turnaround_TimeObj = Beta_TimeObj  - Alpha_TimeObj
  </code></pre>
  
  <p>An example of this <code>Turnaround_TimeObj</code>  time delta is "2 days, 22:13:45". I want to format the output, but I am unable to do so.</p>
  
  <pre><code>print Turnaround_TimeObj.strftime('%H hrs %M mins %S secs')
  </code></pre>
  
  <p>doesn't work.</p>
  
  <p>I know one way of doing this will be to convert it to seconds and then divmoding to get the required formatting.</p>
  
  <p>As in:</p>
  
  <pre><code>totalSeconds = Turnaround_TimeObj.seconds
  hours, remainder = divmod(totalSeconds, 3600)
  minutes, seconds = divmod(remainder, 60)
  print '%s:%s:%s' % (hours, minutes, seconds)
  </code></pre>
  
  <p>But I was wondering if I can do it in a single line using any date time function like <code>strftime</code>.</p>
  
  <p>Actually converting to seconds doesn't work either. If I convert the time delta "1 day, 3:42:54" to seconds using:</p>
  
  <pre><code>totalSeconds = Turnaround_TimeObj.seconds
  </code></pre>
  
  <p>The <code>totalSeconds</code> value is shown as 13374 instead of 99774. i.e. it's ignoring the "day" value.</p>