- 在input中用datetime-local类型
- 在实体类属性使用了
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date starttime;
- 在mybatis中 映射
<result property="starttime" column="starttime" jdbcType="TIMESTAMP"/>
- 数据库字段设计是用datetime
5.问题来了: 在实体类属性使用
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
会报:
The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
换成:
@DateTimeFormat(pattern="yyyy-MM-dd")
存入数据库的数据只有:2021-02-07 00:00:00【例子】
想知道这要如何处理,试了很多方式都不行
主要看你的数据绑定的方式;
非json请求的话,自己去实现Converter接口应该是最舒服的;
jsonformat,看名字就知道不能处理表单了吧