jeudi 17 décembre 2015

Android sqlite how to take today's data from database

My database on create is that:

public void onCreate(SQLiteDatabase db) {
    Log.e(TAG,"db handleroncreta");
    String CREATE_EVENTS_TABLE = "CREATE TABLE If not exists " + TABLE_EVENTS + "("
            + KEY_ID + " INTEGER PRIMARY KEY autoincrement," + KEY_NAME + " TEXT not null,"
           + KEY_LOCATION + " TEXT not null," + KEY_TYPE + " TEXT not null,"
            + KEY_LINK + " TEXT not null,"
            + KEY_START_TIME + " TEXT not null,"
            + KEY_END_TIME + " TEXT not null,"//bu belki null olabilir
     + KEY_DESCRIPTION + " TEXT not null"//bu da null olabilir
    + ")";

    db.execSQL(CREATE_EVENTS_TABLE);
}

İ get this date like that:

formatter= new SimpleDateFormat("yyyy-MM-dd HH:mm");//for sqlite
    sDate=eventStartDate.getTime();//sdate is date

                    startDate = formatter.format(sDate.getTime())

I need hour and minute. So how can i retrieve from databse only today's data from that column? hour and minutes confuse me, i cant do it.

Aucun commentaire:

Enregistrer un commentaire