title: How to annotate a difference of datetime in days
body: <p>I have a <code>Booking</code> model that has <code>start</code> and <code>end</code> datetime fields. I want to know how many days a booking covers. I can do this in Python but I need this value for further annotations.</p>
  
  <p>Here's what I've tried:</p>
  
  <pre><code>In [1]: Booking.objects.annotate(days=F('end')-F('start'))[0].days
  Out[1]: datetime.timedelta(16, 50400)
  </code></pre>
  
  <p>There are a few problems here:</p>
  
  <ul>
  <li>I want an integer (or other number type I can use in calculations) of days as the output, not a timedelta. Setting output_field doesn't do anything meaningful here.</li>
  <li>My sums are based on date<strong>times</strong>. Subtractions like this, without removing the time could lead to the whole number of days being off.</li>
  </ul>
  
  <p>In Python I would do <code>(end.date() - start.date()).days + 1</code>. How can I do that in-database, preferably through the ORM (eg database functions), but a <code>RawSQL</code> would suffice to get this out the door?</p>