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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:01:04+00:00 2026-05-13T10:01:04+00:00

All, I have a MYSQL table with a column called timestamp. It is of

  • 0

All,

I have a MYSQL table with a column called timestamp. It is of DATETIME datatype and has values like “10/1/2009 3:25:08 PM’, “10/1/2009 3:30:05 PM’, “10/4/2009 3:40:01 PM’, etc..

I want to write a SQL query to select all the values in the timestamp field occuring between two dates.. something like this:

select timestamp from tablename where timestamp >= userStartDate and timestamp <= userEndDate

The userInput dates will not have time portions. Can you please suggest the correct MySQL Query Syntax for this?
Thanks

  • 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-13T10:01:04+00:00Added an answer on May 13, 2026 at 10:01 am
    SELECT timestamp
    FROM   tablename
    WHERE  timestamp >= userStartDate
           AND timestamp < userEndDate + INTERVAL 1 DAY
    

    This will select every record having date portion between userStartDate and userEndDate, provided that these fields have type of DATE (without time portion).

    If the start and end dates come as strings, use STR_TO_DATE to convert from any given format:

    SELECT timestamp
    FROM   tablename
    WHERE  timestamp >= STR_TO_DATE('01/11/2010', '%m/%d/%Y')
           AND timestamp < STR_TO_DATE('01/12/2010', '%m/%d/%Y') + INTERVAL 1 DAY
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PHPMyAdmin and I've got a MySQL table column called timestamp. The type
I have a mysql database table with a column called task_end_date and task_name. I
I have a date and time column in my mysql table called start_date and
I have been asked to audit any/all changes in a MySQL table. Does anyone
HI All, We have a .Net 2.0 application which has a MySQL backend. We
I have a table column called post_tags within a table called posts where assigned
I have two mysql tables, one containing details on cars and one containing all
I have data from MySQL showing all organisations a customer got, with all details
I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files.
I'm sure we all have received the wonderfully vague Object reference not set to

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.