I have a date like String date=\"June 02,2013\"
etc.....
I want to Sort the Date field in Ascending and Descending
Could any one help?
I ha
Try this...
Collections.sort(datestring, new Comparator<String>() {
DateFormat f = new SimpleDateFormat("MMM dd,yyyy");
@Override
public int compare(String o1, String o2) {
try {
return f.parse(o1).compareTo(f.parse(o2));
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
}
});
you need to change format of date in the above code.
UPDATED : Updated DateFormat check it..