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

  • Home
  • SEARCH
  • 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 8630909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:08:32+00:00 2026-06-12T09:08:32+00:00

I have a column which has the data like 2012-09-09 13:20:00 , when I

  • 0

I have a column which has the data like 2012-09-09 13:20:00, when I try to query the table, with the following query, it doesn’t include the data on the to date.

Procedure test (IN fromdate date, IN todate date)

Select * from table where date between fromdate and todate

Let’s say the user put in 2012-08-10 to 2012-09-09, then it doesn’t include the data on the 9th Sept. However, if I change the to date to 2012-09-10, then it will include the data. It seems like when there is no time included, mySQL defaults to midnight or 00:00:00

Is there a way to change it or a way around this? Such as, joining the time (23:59:59) to todate at some stage? i.e. using the following

set todate = todate.STR_TO_DATE("23:59:59");
  • 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-06-12T09:08:33+00:00Added an answer on June 12, 2026 at 9:08 am

    You should use > and < operators instead of BETWEEN as it is not inclusive with regards to dates (assuming your column is datetime). If you only specify 2011-01-31, it is the equivalent of 2011-01-31 00:00:00.

    Example:

    SELECT * FROM t1 WHERE date > DATE_SUB(fromdate, INTERVAL 1 SECOND) 
         AND date < DATE_ADD(todate, INTERVAL 1 DAY)
    

    See it in action

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

Sidebar

Related Questions

I have a column which has date-values stored in varchar (format ddmmyy) like this
I have a relation which has an XML column storing data in the following
I have a column with name data-description which has entries like Mumbai,Maharastra,India London,London, Britain
I have a table in which one column (type ntext) has data that includes
I have a table articles that has a column company which has list of
I have a table which has a column called Direct of type char(1). It's
I have a table which has a NVARCHAR column, which could contain a GUID
We have a Oracle 9i database and OrderDetails table which has a column to
I have a result of a query which has BLOB column defined in it.
I have a table in SQLite database of Android which has a column RANK

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.