I used this to create a date and put it into a database:
String currentDateTimeString = DateFormat.getDateInstance().format(new Date());
I want to build a date with a similar format to the one above and compare it with currentDateTimeString.
I have 3 integers. How do I do that (int year, int month, int day)?
UPDATE:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, month);
cal.set(Calendar.YEAR, year);
cal.set(Calendar.DAY_OF_MONTH, day);
Date result = cal.getTime();
String currentDateTimeString2 = DateFormat.getDateInstance().format(result);
I do here something wrong..both arent equal:
currentDateTimeString2==currentDateTimeString //false
String are object, it can’t be compared with
==useequals()method