コード import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Locale; public class App { private static String format(final LocalDate date, final String pattern) { return date.format(DateTimeFormatter.ofPattern(pattern, Locale.JAPAN)); } public static void main(final String[] args) { final LocalDate today = LocalDate.of(2019, 6, 4); System.out.println(format(today, "M")); System.out.println(format(today, "MM")); System.out.println(format(today, "MMM")); System.out.println(format(today, "MMMM")); System.out.println(format(today, "MMMMM")); System.out.println(format(today, "MMMMMM")); } } 結果 パターン 結果 M 6 MM 06 MMM 6 月