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 6918551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:52:25+00:00 2026-05-27T09:52:25+00:00

I am trying to do a query between 2 dates. I would like to

  • 0

I am trying to do a query between 2 dates. I would like to do it without having to worry about the time. When a user enters the 2 dates they want to search on, there is no selection for time. This means that the dates that they enter default to 12:00 AM.

The dates in the table do have times though. I just would like to ignore the times all together so the search brings back any records form said date range.

Here is my SQL:

TheDate BETWEEN @EnteredBeginDate AND @EnteredEndDate

So when a user does a range search between 8/6/2009 AND 9/9/2009 I want to return the records:

8/6/2009 11:33:02 AM
8/6/2009 11:39:17 AM
9/9/2009 8:21:30 AM

What’s happening now is I only get back:

8/6/2009 11:33:02 AM
8/6/2009 11:39:17 AM

Can someone please recommend the best way to do this in SQL? I know how to do it in C#.

  • 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. Editorial Team
    Editorial Team
    2026-05-27T09:52:26+00:00Added an answer on May 27, 2026 at 9:52 am

    Just use DATEADD for the enddate to set it to midnight on the NEXT day…

    TheDate BETWEEN @EnteredBeginDate AND DATEADD(day, 1, @EnteredEndDate)

    If you want to be really precise, you could subtract a second or millisecond from that to make it 11:59:59 on your specified date:

    TheDate BETWEEN @EnteredBeginDate AND DATEADD(second, -1, (DATEADD(day, 1, @EnteredEndDate)))

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

Sidebar

Related Questions

Before trying to query the AD server I would like to check if it
I have a table named ticket. I am trying to query between two dates,
I am trying to query a table that has dates in it. I would
Trying to query a 'Favorites' model to get a list of items a user
I'm trying to query a MySQL database using an array but I'm having trouble!
I am trying to SELECT records from two MySql tables. I would like all
I'm trying to select all dates between 2 dates. In the database I have
I want to use a for loop to print every date between 2 dates.
I'm trying to convert the below SQL query to HQL and am having a
I'm having an issue trying to get my SQL query which works fine in

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.