Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 185841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:32:32+00:00 2026-05-11T15:32:32+00:00

What is the optimal query to obtain all the records for one specific day?

  • 0

What is the optimal query to obtain all the records for one specific day? In my Weather model, ‘timestamp’ is a standard DateTimeField.

I’m currently using

start = datetime.datetime(2009, 1, 31) end = start + datetime.timedelta(hours=23, minutes=59, seconds=59) Weather.objects.filter(timestamp__range=(start, end)) 

but wonder if there is a more efficient method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:32:32+00:00Added an answer on May 11, 2026 at 3:32 pm

    The way it’s done in django.views.generic.date_based is:

    {'date_field__range': (datetime.datetime.combine(date, datetime.time.min),                        datetime.datetime.combine(date, datetime.time.max))}  

    There should soon be a patch merged into Django that will provide a __date lookup for exactly this type of query (http://code.djangoproject.com/ticket/9596).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would be the optimal way to match that all of a set of
I am trying to find out the optimal model for 4-way gradient filling. My
I have been thinking about the optimal way to create an XML file using
I'm using some not optimal code written by me... :-| I have following code:
What do you find is the optimal setting for mysql slow query log parameter,
I have the following SQL query to return all Customers who have no OrderLines
UNION and UNION ALL queries can outperform equivalent queries using OR -connected predicates under
What is the optimal way to create an array from query result cursor? results
I'm trying to figure out the optimal combination of indexes for the query below.
In rails 3, using activerecord, is there a single-query way to set the :hidden

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.