If the date strings are in the format "yyyy-MM-dd", you can apply a simple string comparison:
String s1 = new String("2012-01-27"); String s2 = new String("2011-01-28"); System.out.println(s1.compareTo(s2));
The result will be TRUE if s1 is lexicographically βgreaterβ than s2, and what you need. For more information, read javadoc for the compareTo () method.
Viktor Stolbin
source share