Created
October 21, 2017 08:21
-
-
Save gevorg/e1d1ffeefd25eb172ba1671fcba2df2a to your computer and use it in GitHub Desktop.
Custom month name java8
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
def monthNameMap = [1L: "MIK", 2L: "PIK", 3L: "CIK"] | |
LocalDate date = LocalDate.now() | |
DateTimeFormatter formatter = new DateTimeFormatterBuilder() | |
.appendPattern("yyyy ") | |
.appendText(ChronoField.MONTH_OF_YEAR, monthNameMap) | |
.toFormatter(Locale.FRENCH) | |
for (int i = 0; i < 12; ++i) { | |
date = date.minusMonths(1) | |
println formatter.format(date) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment