0

I have a table in SQLite that has four columns (id,login_date, logout_date, userid). The date fields has stored like as : 2018-09-18 17:20:19.955000. I want to select rows in a period of date regardless of hour, minute ... I get a date from applications user (FromDate and ToDate). How I can make a query with ORMLite only on the first 10 characters of dates field in the database?

SELECT substr(login_date,1,10) FROM articles where uid='20';
Amirhosein
  • 4,266
  • 4
  • 22
  • 35
  • Possible duplicate of [Best way to work with dates in Android SQLite](https://stackoverflow.com/questions/7363112/best-way-to-work-with-dates-in-android-sqlite) – TDG Sep 21 '18 at 18:47

1 Answers1

0

this question may be a duplicate of this

Sqlite do not support date type, so it will be easier to compare TimeStamp, the simple way to achieve your requirement is to save TimeStamp instead of Date. After that, you can compare to DateToMidNightTimeStamp.

Anis BEN NSIR
  • 2,555
  • 20
  • 29