title: Python GAE datastore datetime query.filter by day
body: <p><strong>Python Google App Engine (GAE)</strong></p>
  
  <p>In the datastore I have stored datetime on entries, which is in UTC (Expected behavior).</p>
  
  <p>The issue is when using a query.filter to grab a specific day in another time zone.</p>
  
  <p>Example GAE datastore datetime entries (UTC):</p>
  
  <ul>
  <li>2014-11-4 11pm UTC</li>
  <li>2014-11-4 12pm UTC</li>
  <li>2014-11-4 01am UTC</li>
  </ul>
  
  <p>Simple enough to pull those entries by date using UTC:</p>
  
  <pre><code>query_date = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
  query.filter('DateTimeUTC &gt;=', query_date)
  query.filter('DateTimeUTC &lt;', query_date+timedelta(days=1))
  </code></pre>
  
  <p>Or like this:</p>
  
  <pre><code>start_date = datetime.strptime('11/04/2014', '%m/%d/%Y')
  end_date = datetime.strptime('11/05/2014', '%m/%d/%Y')
  query.filter('DateTimeUTC &gt;=', start_date)
  query.filter('DateTimeUTC &lt;', end_date)
  </code></pre>
  
  <p>However, let's consider the fact that although those three entries were entered on 11/04/2014 in accordance with UTC, the original user was in PST, thus making that third entry actually on 11/03/2014, not on the 4th (1am UTC = previous day 5pm PST).</p>
  
  <p>So using this example code and data, let's imagine a much bigger set of data, all entered by users in PST, EST, etc. and now you're trying to pull specific days for each of them (let's focus on PST to stay consistent - UTC-8).</p>
  
  <p>How can you query.filter for days in a specific time zone instead of using UTC's definition of days?</p>
  
  <p>Again, try sticking to PST so we're all on the same page.</p>
  
  <p>I'm trying to keep things simple and clean using this format, but if my style of code on GAE is slow performance-wise or there is a better route (proven by speed compared to this) then I'm all for it.</p>