I have a problem, I want to parse to different type of date string to timestamp.
I used
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern ="dd-MMM-yyyy HH:mm:ss.SSS z",timezone="IST")
private Timestamp validUptoDate;
and parsing is Ok when milisecond value is given after second, But if I provide "16-DEC-2014 15:20:30 IST"
this type of date, getting below exception ::
Failed to parse Date value '15-AUG-2019 19:30:00 IST' (format: "dd-MMM-yyyy HH:mm:ss.SSS z"): Unparseable date: "15-AUG-2019 19:30:00 IST"
But If I provide "16-DEC-2014 15:20:30.000 IST"
, then no issues. But I dont want to mention milisecond value if not present.
I tried to provide two pattern value llike
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern ={"dd-MMM-yyyy HH:mm:ss z","dd-MMM-yyyy HH:mm:ss.SSS z"} ,timezone="IST")
but compilation error happens. I tried using different combination, but no hope. Please help. Thanks a lot.