sqlite SQL Date Query Question

Asked 2 years ago, Updated 2 years ago, 77 views

I want to select a date range in sqlite, but it doesn't work normally.

SELECT * FROM test WHERE date BETWEEN "11/1/2011" AND "11/8/2011";

How do I send a query?

sqlite sql

2022-09-22 21:24

1 Answers

In sqlite, date format should be as follows.

YYYY-MM-DD
YYYY-MM-DD HH:MM
YYYY-MM-DD HH:MM:SS
YYYY-MM-DD HH:MM:SS.SSS
YYYY-MM-DDTHH:MM
YYYY-MM-DDTHH:MM:SS
YYYY-MM-DDTHH:MM:SS.SSS
HH:MM
HH:MM:SS
HH:MM:SS.SSS
now
DDDDDDDDDD

Try changing the query as below

SELECT * FROM test WHERE date BETWEEN "2011-01-11" AND "2011-8-11"

For more information, see SQLite site.


2022-09-22 21:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.