2

I'm getting this error when I'm trying to do a POST:
"JSON parse error: Cannot deserialize value of type java.time.OffsetDateTime from String "2021-04-08T05:00:25": Failed to deserialize java.time.OffsetDateTime: (java.time.format.DateTimeParseException) Text '2021-04-08T05:00:25'

and I'm using these

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private OffsetDateTime createDate = null;


  @JsonProperty("finish_date")
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private OffsetDateTime finishDate = null;

and my JSON are these:

  "create_date": "2021-04-08T05:00:25",
  "finish_date": "2021-04-08T05:00:25",
dcm50
  • 103
  • 3
  • 13
  • You are trying to parse into an `OffsetDateTime` with no offset info in the input string. Try using `LocalDateTime` instead – Kaus2b Oct 27 '21 at 17:38
  • BTW your pattern needs to be `"yyyy-MM-dd'T'HH:mm:ss"` – Kaus2b Oct 27 '21 at 17:43
  • I still have same error.. Another question: I'm mapping these dates with Types.DATA, because in my oracle database, the parameter is set as SYSDATE. – dcm50 Oct 27 '21 at 20:47
  • maybe this helps? https://stackoverflow.com/questions/28802544/java-8-localdate-jackson-format – Kaus2b Oct 27 '21 at 20:58

0 Answers0