[java] How to get Month Name from Calendar?

Month::getDisplayName

Since Java 8, use the Month enum. The getDisplayName method automatically localizes the name of the month.

Pass:

  • A TextStyle to determine how long or how abbreviated.
  • A 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()
    );
}