I have a Spring Boot API where in JSON request Date field is send but in application code it is not getting formatted correctly and hence DB call is failing due to binding issue
This field is sent in JSON request :-
"created_at": "2014-08-12 11:48:41.000000"
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss.SSSSSS", timezone="AEST")
private Date createdAt;
When the getCreatedAt() method is called the Date is coming in format - Tue Aug 12 07:48:41 EDT 2014
But I am expecting it in same format the way it was sent
private String createdAt;instead ofprivate Date createdAt;later convert it into date object.@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSSSSS"). hope this helps.