I have a table that has time column in yyyy-MM-dd:HH:mm
format .I want to get the the time value that is nearest to current time and date.I am able to get the time value that is nearest to current time but not the date.
This is what I am doing
SimpleDateFormat mSDFmSDF = new SimpleDateFormat("HH:mm");//yyyy-MM-dd:HH:mm not working
Calendar calSet = Calendar.getInstance();
TimeZone tz = TimeZone.getDefault();
mSDF.setTimeZone(tz);
String time = mSDF.format(calSet.getTime());
Cursor selectedtime = mDB.rawQuery("SELECT " + ALARM_TIME + " FROM "
+ ALARM_TABLE + " WHERE " + ALARM_TIME + " >= '" + time
+ "' ORDER BY " + ALARM_TIME + " LIMIT 1 ;", null);
Every suggestions are welcomed please help me