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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:05:39+00:00 2026-06-04T23:05:39+00:00

I kind of assumed it was a string, so I compared it as a

  • 0

I kind of assumed it was a string, so I compared it as a string, but not surprisingly it failed. I believe thats how it works in Mysql. I could be wrong as I haven’t worked on it in a while. In either case, how can I check if dates are equal in SQLite? I will be using it in a WHERE clause.

SELECT a._id, b._id, b.start_date,a.event_name, b.start_time, 
b.end_date, b.end_time, b.location FROM events_info b INNER JOIN events a ON
 a._id=b.event_id WHERE b.start_time = '6:00';

(added space to make it easier to look at)

  • 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-04T23:05:42+00:00Added an answer on June 4, 2026 at 11:05 pm

    SQLite doesn’t have a dedicated DATETIME type. Normally what people do is make sure they store the date as a formatted string that is consistent; for example, YYYY-MM-DD hh:mm:ss. If you do so, as long as you’re consistent, then you can compare dates directly:

    SELECT * FROM a WHERE q_date < '2013-01-01 00:00:00';
    

    This works because even though the comparison is technically an alphabetical comparison and not a numeric one, dates in a consistent format like this sort alphabetically as well as numerically.

    For such a schema, I would suggest storing dates in 24-hour format (the above example is midnight). Pad months, days, and hours with zeros. If your dates will span multiple timezones, store them all in UTC and do whatever conversion you need client-side to convert them to the local time zone.

    Normally dates and times are stored all in one column. If you have to have them separated for whatever reason, just make sure you dates are all consistent and your times are all consistent. For example, dates should all be YYYY-MM-DD and times should all be hh:mm:ss.

    The reason that YYYY-MM-DD hh:mm:ss is the preferred format is because when you go from the largest date interval (years) to the smallest (seconds), you can index and sort them very easily and with high performance.

    SELECT * FROM a WHERE q_date = '2012-06-04 05:06:00';
    

    would use the index to hone in on the date/time instead of having to do a full table scan. Or if they’re in two separate rows:

    SELECT * FROM a WHERE q_date = '2012-06-04' AND q_time = '05:06:00';
    

    The key is to make sure that the dates and times are in a consistent format going into the database. For user-friendly presentation, do all conversion client-side, not in the database. (For example, convert ‘2012-06-04 05:06:00’ to “1:06am Eastern 6/4/2012”.)

    If this doesn’t answer question, could you please post the exact format that you’re using to store your dates and times, and two example dates that you’re trying to compare that aren’t working the way you expect them to?

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

Sidebar

Related Questions

I've seen multiple instance of that kind of question, but not the one I'm
I'm currently trying to make an application which could digitally sign any kind of
Kind of like this question I have many text snippets that I use many,
Kind sirs, I'm using Codeigniter to build a blog. I might need a way
Kind of need help understanding what this code actually outputs. Does it out put
Kind of a ruby-noob active record query question: Magazine has_many :subscriptions User has_many :subscriptions
What kind of problems might this cause? Is it better to install in a
I kind of feel like I'm abusing the DOM with my code... for(var i=0;
What kind of skills should a WPF developer know to create MVVM applications? Things
What kind of audio files are you using in your iPhone games/apps? I have

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.