Pritesh
Pritesh

Reputation: 23

How to search between two dates in java with Sqlite database

I am using jCalender to input date

String from_date = ((JTextField) txt_bilty_date_start.getDateEditor().getUiComponent()).getText();
String to_date = ((JTextField) txt_bilty_date_end.getDateEditor().getUiComponent()).getText();
String sql = " "; //what query I need to use

enter image description here

Upvotes: 2

Views: 969

Answers (1)

magic-sudo
magic-sudo

Reputation: 1246

I'm not java pro but SQL statement could be like this

select * from POSTS where Id = 1
       and Date between '2011/02/25' and '2011/02/27'

or can use

select * from POSTS where Id = 1
       and Date >= '2011/02/25' and Date <= '2011/02/27'

Upvotes: 1

Related Questions