title: Filter objects with a datetime range (00:00 to 23:59:99) in Django
body: <p>I used django model filter with date.</p>
  
  <p>Origin data has time of Africa/Abidjan(UTC+00:00) and I save this data on my database.</p>
  
  <p>I set timezone about Asia/Seoul(UTC+09:00)and it's save well in my database.</p>
  
  <p>But I filter data with time_range=[2015-11-15, 2015-11-16], I got data about from 15 o'clock to 14 o'clock. I want to get data from 0 o'clock to 23 o'clock.</p>
  
  <p>How can I get this? I do <a href="https://djangosnippets.org/snippets/2759/" rel="nofollow noreferrer">this url</a>, but it doesn't work well.</p>
  
  <pre><code>class Post(models.Model):
      created_time = models.DateTimeField()
  </code></pre>
  
  <p>If I have a model like post, and I get date from user.</p>
  
  <pre><code>input_date = '2015-11-16' (from user)
  from_date = datetime.strptime(input_date, '%Y-%m-%d').date()
  to_date = from_date + datetime.timedelta(days=1)
  posts = Post.objects.filter(created_time__range=[from_date, to_date])
  </code></pre>
  
  <p>I used upper code and got data from 2015-11-15 15:00:00 to 2015-11-16 14:00:00.</p>
  
  <p><a href="https://i.stack.imgur.com/fzFKU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fzFKU.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/LY17E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LY17E.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/w35vc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w35vc.png" alt="enter image description here"></a></p>