关于orcale数据库,字段的时间格式为yyyy-mm-dd 00:00:00时,时间的加减的方法

select * from t_xxtx t 
where (to_date(t.xxtx_endtime,'yyyy-mm-dd hh24:mi:ss')-sysdate)>1 
and (to_date(t.xxtx_endtime,'yyyy-mm-dd hh24:mi:ss')-sysdate)<2;

业务情景是:
字段样式为varchar2 时间类型为String ,时间:2019-05-29 16:00:30,
为了查出距离系统时间一天的内容(有点小瑕疵,没那么精确)
本来想用时间戳,但是前台比较难处理,相对而言在sql上处理是最便捷的

猜你喜欢

转载自blog.csdn.net/nuoyuezuo/article/details/90641203