I have Two String Datetime as follows:
String Date1 = "05-09-2013 10:46:10"
String Date2 = "06-09-2013 10:46:10"
I Need to compare these datetimes and i need result.
try{
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
String str1 = "12/10/2013";
Date date1 = formatter.parse(str1);
String str2 = "13/10/2013";
Date date2 = formatter.parse(str2);
if (date1.compareTo(date2)<0)
{
System.out.println("date2 is Greater than my date1");
}
}catch (ParseException e1){
e1.printStackTrace();
}