I am creating a method that will take a stored date and time from a DB which is stored as TEXT, use that date/time to then check between the current time and the current time plus one.
The issue I am having is checking between the two date and times because I have stored them all as Strings, I'm not sure how to check if it is between the hour:
private int mYear, mMonth, mDay, mHour, mMinute;
listOfAllDateTimesToSendText = gameDetailsFromDatabase.agReturnDateTime();
calendar = Calendar.getInstance();
mYear = calendar.get(Calendar.YEAR);
mMonth = calendar.get(Calendar.MONTH);
mDay = calendar.get(Calendar.DAY_OF_MONTH);
mHour = calendar.get(Calendar.HOUR_OF_DAY);
mMinute = calendar.get(Calendar.MINUTE);
String currentDateTime = mYear + "-"+ mMonth + "-" + mDay + " " + mHour + ":" + mMinute + ":00";
String currentDateTimePlusOneHour = mYear + "-"+ mMonth + "-" + mDay + " " + mHour + 1 + ":" + mMinute + ":00";
while(listOfAllDateTimesToSendText.moveToNext()){
String dateTimeFromCusor = listOfAllDateTimesToSendText.getString(listOfAllDateTimesToSendText.getColumnIndex(MainAutomateGames.AutomateGamesTable.COLUMN_DATE_TO_SEND_TEXT));
if(dateTimeFromCusor == currentDateTime || dateTimeFromCusor == currentDateTimePlusOneHour){
}
I have been looking around SO and the net but a lot of them using Date
, or DateFormat
, or yyyy-mm-dd
etc and to be honest I am getting quite confused on which I should use for my current scenario.