Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Erro usando a Classe DateTimeFormatter

LocalDate today = LocalDate.now();

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/mm/yyyy");

        String hojeformatado = formatter.format(today);

        System.out.println(hojeformatado);

Exception in thread "main" java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: MinuteOfHour at java.time.LocalDate.get0(Unknown Source) at java.time.LocalDate.getLong(Unknown Source) at java.time.format.DateTimePrintContext.getValue(Unknown Source) at java.time.format.DateTimeFormatterBuilder$NumberPrinterParser.format(Unknown Source) at java.time.format.DateTimeFormatterBuilder$CompositePrinterParser.format(Unknown Source) at java.time.format.DateTimeFormatter.formatTo(Unknown Source) at java.time.format.DateTimeFormatter.format(Unknown Source) at ILearn.Datas.main(Datas.java:41)

1 resposta
solução!

Erro está na formatação.

"dd/mm/yyyy"

correto = "dd/MM/yyyu"

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software