Month::getDisplayName
Since Java 8, use the Month
enum. The getDisplayName
method automatically localizes the name of the month.
Pass:
TextStyle
to determine how long or how abbreviated.Locale
to specify the human language used in translation, and the cultural norms used for abbreviation, punctuation, etc.Example:
public static String getMonthStandaloneName(Month month) {
return month.getDisplayName(
TextStyle.FULL_STANDALONE,
Locale.getDefault()
);
}