如何解决前台的String类型的时间字符串是否异常传输到后台?
我基于前景中的时间执行查询操作,并将时间字符串“ 2020-08-02 12:30:30”传递给后台,后台控制台抛出此错误:
提示信息:
default message [Failed to convert property value of type'java.lang.String' to required type'java.util.Date' for property'scanTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat java.util.Date] for value '2020-08-02 12:30:30'; nested exception is java.lang.IllegalArgumentException : Invalid format: "2020-08-02 12:30:30" is malformed at "12:30:30"]
数据库中的该字段的类型为date。我在前台使用了"@DateTimeFormat(iso=DateTimeFormat.ISO.DATE)"
注解。为什么会发生此错误?
@DateTimeFormat(iso=DateTimeFormat.ISO.DATE)
private Date scanTime;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。