Recently, we are engaged in local SQLite queries. We need to query data within a certain period of time. In SQL, we all know that:
select * from tblName where rDate Between '2008-6-10' and '2008-6-12'
There is no problem in this way, but in SQLite we cannot get the result of writing this way. After trying it many times, we finally found that the rule is as follows:
select * from tblName where rDate Between '2008-06-10' and '2008-06-12'
This is OK, so the rule we get is that our time must be formatted, So we introduced the following code to format the time:
Simpledateformat SDF = new simpledateformat ("yyyy-mm-dd"); cur_calender.set (year, month, day); Switch (sel_date_type) {Case 1: // start time if (search_date_begin! = NULL) {date_start = SDF. Format (cur_calender.gettime (); search_date_begin.settext (date_start);} break; Case 2: // end time if (search_date_end! = NULL) {date_end = SDF. Format (cur_calender.gettime (); search_date_end.settext (date_end);} break; default: break ;}}
Now OK!