mercredi 22 avril 2015

SQlite select time between two dates

I have a table in SQlite database that has two attributes start_time ,end_time stored in the following format "HH:MM". I am trying to get start_time and end_time between current time using the following query

DateFormat df = new SimpleDateFormat("HH:MM");
        String dateNowString = df.format(Calendar.getInstance().getTime());

        String selectQuery = "SELECT  * FROM " + TvScheduleDatabase.TvRecord.TABLE_NAME+" WHERE "+"date("+"'"+dateNowString+"'"+") BETWEEN "
                +"date("+TvScheduleDatabase.TvRecord.COLUMN_NAME_START_TIME+")"+" AND "+" date("+TvScheduleDatabase.TvRecord.COLUMN_NAME_END_TIME+")";

but it doesn't get data correctly from database,any help please?

Aucun commentaire:

Enregistrer un commentaire