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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:20:12+00:00 2026-06-17T17:20:12+00:00

I have a table containing records with DateTime datatype in MySQL (e.g. 2013-01-17 21:16:06),

  • 0

I have a table containing records with DateTime datatype in MySQL (e.g. 2013-01-17 21:16:06),
while on my entity I choose LocalDateTime datatype for the date field. During my queries I would like to retrieve all records based on 2 Dates only (fromDate and toDate using a datepicker). Lets say I choose the same date for both fromDate and toDate, the issue is both value would be the same since the time is 00:00:00, hence gives no result from the database.

I am curious if I have used the right datatype from Joda. Am I required to adjust the time for both values lets say 00:00:00 for fromDate and 23:59:59 for toDate ? Or what’s the better approach ?

  • 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-17T17:20:13+00:00Added an answer on June 17, 2026 at 5:20 pm

    Given a datetime column and two arbitrary dates as input, you can write:

    SELECT * FROM `table`
    WHERE `datetime` >= @startDate
    AND   `dateTime` <  @endDate + INTERVAL 1 DAY
    

    Where:

    • startDate is the starting date, inclusive
    • endDate is the ending date, exclusive

    What the above means is best explained through the following cases:

    1. To see all records for 2013-01-17 (one day) startDate should be 2013-01-17 and endDate should be 2013-01-17
    2. To see all records for 2013-01-17 – 2013-01-18 (two days) startDate should be 2013-01-17 and endDate should be 2013-01-18.

    This makes choosing the dates intuitive. The < sign ensures that the calculated end date is excluded from the results (e.g. in the first case the query omits `2013-01-18 00:00:00 records).

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

Sidebar

Related Questions

I have a table watchlist containing today almost 3Mil records. mysql> select count(*) from
I have a table containing records of the date and time each product was
I have a table containing multiple records for different transactions i.e. ID Date REF
I have a MySql table containing over 500,000 records. This table contains some keywords
I have a table with several hundred records, each one containing a datetime column.
I have a table in my MySQL database containing 200K records. Each record contains
I have a table containing view/click records. The time is stored in a unix
I have two large tables in MySQL, one containing about 6,00,000 records and another
I have a table containing reports and the date/time they were created. I'd like
I have a table containing 2 date fields and an identifier (id, fromdate and

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.