0

I was trying to format LocalDate to String while sending response to Json using below annotation

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MMM-YYYY")

but for few dates, it changes date to next year

For ex: my expected date is 30-Dec-2020

but result output is 30-Dec-2021

arpit garg
  • 61
  • 5
  • 2
    `YYYY` is "week year". You want "yyyy". I'm sure this is a dupe... will try to find it. (If you can change the JSON format to yyyy-MM-dd, that would be even better... that's the ISO-8601 format.) – Jon Skeet Apr 05 '21 at 06:46
  • Thanks @JonSkeet.. yes i just figured out the same. – arpit garg Apr 05 '21 at 06:56

0 Answers0