I have a time field value like below :
2020-10-01T15:30:27.4394205+03:00
I can't figure it out how to represent as date Format.
i need to deserialize it to LocalDateTime field.
I have tried like this;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS")
private LocalDateTime timestamp;
but it doesn't work. How can i deserialize it? I am using spring boot by the way. And this value coming to rest controller request body.
Replace the pattern as
pattern = DateTimeFormatter.ISO_OFFSET_DATE_TIME
Your date-time string is already in the format specified by
DateTimeFormatter.ISO_OFFSET_DATE_TIME
which is the default format used byOffsetDateTime#parse
.Demo:
Output: