I am using:
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
@JsonFormat( pattern = "MM-dd-yyyy" )
private LocalDate start;
but it accept 02-30-2019
and convert to 02-28-2019
Automatically. But i want restrict that date.
I also used:
@DateTimeFormat(iso = java.time.format.DateTimeFormatter.ISO_DATE)
@JsonFormat( pattern = "MM-dd-yyyy" )
private LocalDate start;
but it give compile time error: Attribute value must be constant
.
ankit here:
I have same issue and also used u
in place of y
but not help:
@FutureOrPresent
@DateTimeFormat( iso = DateTimeFormat.ISO.DATE,pattern = "MM-dd-uuuu")
@JsonFormat( pattern = "MM-dd-uuuu" )
private LocalDate start;
i want to restrict at time of parsing. It accept 02-31-2019
and convert automatically to 02-28-2019
. refer: https://stackoverflow.com/a/41104034/6097074
Now 09/08/2018
If i am using: private LocalDate start;//without using DateTimeFormat and JsonFormat annotation
this work fine if i use: yyyy-MM-dd
format date in json i.e. 2014-01-01
.
But i need to parse to MM-dd-yyyy
.
Kind help to solve this, Thanks.