@DateTimeFormat(pattern = "yyyy-MM-dd")
//@JsonFormat(pattern = "yyyy-MM-dd" , timezone="GMT+8")
private Date date;
报错信息是这样的
code:400
data:{}
msg:
"date:Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@com.alibaba.excel.annotation.format.DateTimeFormat java.util.Date] for value '2023-9-01'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2023-9-01]"
success:false
迷惑的点在于如果加上 HH:mm:ss 的话,把日期+00:00:00 就不会报错。
请教一下大佬到底怎么办才能让后端正确接收这个不带时分秒的日期?