title: Django date comparison different on server
body: <p>I have just become aware of some very strange date comparison behaviour on our production setup which I don't understand.</p>
  
  <p><strong>Listing Model</strong></p>
  
  <pre><code>title (CharField)
  from_date (DateTimeField)
  to_date (DateTimeField)
  </code></pre>
  
  <p><strong>QuerySet</strong></p>
  
  <pre><code>now = arrow.now()
  Listing.objects.filter(to_date__gte=now.datetime)
  </code></pre>
  
  <p><strong>Setup</strong></p>
  
  <ul>
  <li>Python 2.7</li>
  <li>Django 1.7</li>
  <li>SQLite / PostgreSQL</li>
  <li>Ubuntu</li>
  </ul>
  
  <p><strong>Issue</strong></p>
  
  <p>When a listing object's to_date is set to an hour earlier than now, both on the development server and the shell on the production server, the query set returns the correct results (the listing in question is not included). However, on the production server, the query continues to include the listing (no caching is enabled). I have determined that if I set the listing's day to the previous day it is then properly excluded making it seem that only days are being compared (I even set the time to 00:00 to rule out timezone issues, but this still included the listing - as noted, only changing the day worked). Why is this happening please and how can I fix it?</p>
  
  <p><strong>Additional Info</strong></p>
  
  <ol>
  <li>I have used the "date" command to confirm the server timezone agrees with the timezone specified in settings.py</li>
  <li>I have confirmed that <code>USE_TZ = True</code> in settings.py and that TIME_ZONE has been properly set.</li>
  <li>I have logged onto the PostgreSQL terminal on the server and ran the <code>now</code> command - this returned the same timezone as both that of the system and that specified in settings.py</li>
  <li>I have confirmed the to_date field in postgresql is a "timestamp with time zone field"</li>
  <li>Extract of actual sql passed to db:<code>WHERE ( "directory_listing"."to_date" &gt;= 2015-08-22 14:01:56.663072)</code></li>
  </ol>