Created
March 10, 2016 21:56
-
-
Save codingtony/826fe970254c93365909 to your computer and use it in GitHub Desktop.
date range in reversed strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTimeFormatterBuilder dtfb = new DateTimeFormatterBuilder().appendYear(4, 4).appendMonthOfYear(2).appendDayOfMonth(2); | |
DateTimeFormatter formatter = dtfb.toFormatter(); | |
String s = "20140501"; | |
String e = "20140510"; | |
LocalDate start = LocalDate.parse(s,formatter); | |
LocalDate end = LocalDate.parse(e,formatter); | |
StringBuilder sb = new StringBuilder(); | |
while (!start.isAfter(end)) { | |
formatter.printTo(sb,start); | |
start = start.plusDays(1); | |
System.out.println(sb.reverse()); | |
sb.setLength(0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment