I have a requirement that I need to compare two Dates. One Date will come from DB which is String in \"YYYY-DD-MM\" firm and I need to compare this String Date with current Date
Calendar c = Calendar.getInstance(); SimpleDateFormat tf = new SimpleDateFormat("yyyy-MM-dd"); String time=DB time; Date parseTime= tf.parse(time); Integer dayNow=c.getTime().getDate(); Integer dayDb=parseTime.getDate();
then you can compare dayNow and dayDb.
dayNow
dayDb