问题:
如题,使用Mybatis plus插件,想对postgresql 中timestamp字段进行筛选,使用QueryWrapper进行操作,结果报错。
ERROR: operator does not exist: timestamp without time zone > character varying
No operator matches the given name and argument types.You might need to add explict type casts.
思路:大概率是时间转换报错。
解法:
注意此处的格式必须是 yyyy-mm-dd hh:mm:ss[.f...] 这样的格式,中括号表示可选,否则报错,查了下使用Timestamp函数转换一下就好了。
Timestamp startTime= Timestamp.valueOf("vo.getStartTime()");
Timestamp endTime= Timestamp.valueOf("vo.getEndTime");
进阶:
Timestamp和LocalDateTime区别。
LocalDateTime,Date:
没有(无法)包含时区(本地时间,隐式的指默认时区ZoneId.system