如何使用 Sqlite 数据库在 java 中的两个日期之间进行搜索
How to search between two dates in java with Sqlite database
我正在使用 jCalender 输入日期
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
我不是 java 专业人士,但 SQL 声明可能是这样的
select * from POSTS where Id = 1
and Date between '2011/02/25' and '2011/02/27'
或者可以使用
select * from POSTS where Id = 1
and Date >= '2011/02/25' and Date <= '2011/02/27'
我正在使用 jCalender 输入日期
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
我不是 java 专业人士,但 SQL 声明可能是这样的
select * from POSTS where Id = 1
and Date between '2011/02/25' and '2011/02/27'
或者可以使用
select * from POSTS where Id = 1
and Date >= '2011/02/25' and Date <= '2011/02/27'