Retrieve Data from Sqllite DB between Two dates android

前端 未结 4 1047
盖世英雄少女心
盖世英雄少女心 2020-12-22 13:17

I retrieve data between two dates some how it get correct result and some how it output empty listview when i select dates with month it work properly but when i select dat

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 13:32

    we have Two solution for this question

    one is we need to convert date and time into milliseconds, and take long data type in

    Sqllite database and save values(converted date and time). And the write query like "SELECT

    data, start_date, end_date from tablename WHERE start_date > end_date".

    Second way is you need to save start and end date+time(yyy-MM-dd HH:mm:ss) in string format

    in Sqllite database, and you need to query like this,

    "SELECT datetime_start,datetime_end FROM tablename WHERE(( DATETIME(atetime_start) >=

    DATETIME ("+"'"+entry_start_time+"'"+")" +" AND DATETIME(datetime_end) < DATETIME

    ("+"'"+entry_end_time+"'"+")); .

提交回复
热议问题