比较 ZonedDatetime 删除 SQLite 中的记录?

Compare ZonedDatetime to delete records in SQLite?

问题: 我在 SQLITE 数据库中有一列存储 ZonedDateTime。我需要使用此 ZonedDateTime 时间戳列删除早于特定日期的记录。

至此完成:

已通过

解决问题
public ArrayList<String> CompareZDT(String st) {

    ArrayList<String> ZDTtodelete;
    ArrayList<String> ZDTrejected;
    ZDTtodelete = new ArrayList<String>();
    ZDTtoavoid = new ArrayList<String>();

    LocalDate todaysDate = LocalDate.now(ZoneId.of("Asia/Riyadh"));
    LocalDate checkDate = todaysDate.minusDays(120);

    String selectQuery = "SELECT * FROM " + Tablename + ";";

    SQLiteDatabase database = dbHelper.getWritableDatabase();
    Cursor cursor = database.rawQuery(selectQuery, null);
    if (cursor.moveToFirst()) {
        do {

            if(ZonedDateTime.parse(cursor.getString(5)).toLocalDate().isBefore(checkDate)) {
                ZDTtodelete.add(cursor.getString(7));
            }else
            {
                ZDTrejected.add(cursor.getString(7));
            }

        } while (cursor.moveToNext());
    }
    cursor.close();

    if (st.equals("DELETE"))
    {
        return ZDTtodelete;
    }else
    {
        return ZDTrejected;
    }

}

使用数组列表[ZDTtodelete],循环检查数据库中的TIMESTAMP列,从而完成删除操作。