Wednesday 11 May 2016

Can not construct instance of java.util.Date from String value

Can not construct instance of java.util.Date from String value

SEVERE: Servlet.service() for servlet [Jersey Rest Service] in context with path [/voice] threw exception [com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.util.Date from String value '12-01-2016': not a valid representation (error: Failed to parse Date value '12-01-2016': Can not parse date "12-01-2016": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))
 at [Source: org.apache.catalina.connector.CoyoteInputStream@aca01d2; line: 6, column: 22] (through reference chain: com.voice.dto.VoiceSurveyRequestDto["feedbackAt"])] with root cause
com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.util.Date from String value '12-01-2016': not a valid representation (error: Failed to parse Date value '12-01-2016': Can not parse date "12-01-2016": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))

From the error stack provide date in following format.
1. yyyy-MM-dd'T'HH:mm:ss.SSSZ"
ex : 2016-10-01T09:45:00.000

2."yyyy-MM-dd'T'HH:mm:ss.SSS'Z'".
ex : 2016-10-01T09:45:00.000

3. "EEE, dd MMM yyyy HH:mm:ss zzz"
ex : 2016-10-01T09:45:00.000

4."yyyy-MM-dd"
ex : 2016-10-01

No comments:

Post a Comment