Search code examples
javadate-formattingjava-timedatetimeformatter

How to get full month name with DateTimeFormatter.ofPattern()


When I use this code to get the actual date:

String dateActuelle = DateTimeFormatter.ofPattern("dd MMMM uuuu").format(LocalDate.now());

It returns "06 sept. 2021" in french but I would like to get "06 septembre 2021" (full month name).

Do you know how I can do this?


Solution

  • With MMMM it will give the full month name, like September while, MMM will give month name in short, like Sept

    Please verify by mistake you might have typed 3 M's while formatting in code.