1

I search for a pattern which looks like this: Thu, 11. 05. 1999 So I tried this syntax:

String pattern = "DDD, dd. mm. uuuu";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);

But it won't work. When trying to format a LocalDate I get java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: MinuteOfHour.

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
LolIPop65
  • 43
  • 5
  • may be this can help -> https://stackoverflow.com/questions/12575990/calendar-date-to-yyyy-mm-dd-format-in-java I prefer SimpleDateFormatter – bmavus Dec 30 '17 at 18:22
  • @bmavus You prefer `SimpleDateFormat`? That class has proven troublesome for years (see how many questions about unexpected `SImpleDateFormat` behaviour there are on Stack Overflow). And it’s long outdated. IMHO the OP is doing very well in using `java.time`, the modern Java date and time API. We all should. Also your link doesn’t seem to explain how to get weekday, as the question title asks. – Ole V.V. Dec 31 '17 at 07:00
  • LolIPop65, next time plesae be specific about how your code doesn’t work. Specify precisely how the observed outcome is different from the expected. In many situations it will give us a much better basis for helping you. – Ole V.V. Dec 31 '17 at 07:03

1 Answers1

2

A look into the official documentation of Java explaining the format pattern syntax is always good:

  • E = day-of-week
  • M = month
  • m = minute

So you should try this pattern:

EEE, dd. MM. uuuu

And setting the locale explicitly to English is also a good idea.

Meno Hochschild
  • 42,708
  • 7
  • 104
  • 126