access 中有一个时间差的函数可以直接用,可以用datediff这个函数
oracle中没有datediff()函数如果是用oracle的话 使用这个来计算时间差
精确到秒:ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60 * 60)精确到毫秒:ROUND(TO_NUMBER(END_DATE - START_DATE) * 24 * 60 * 60 * 60)
select …………from table ……… where datediff(ss,starttime,endtime)?(某个数)
精确到秒
with t(d) as (select '2014-1-21 11:13:10'
union all select '2014-1-10 00:00:00'),
t1(d) as (select cast(d as datetime) from t)
select * from t1
where d between dateadd(ss, -1000, getdate()) and dateadd(ss, 1000, getdate())
oracle写法:SELECT * FROM 表 t WHERE t.fcjsj>to_date('2013-01-04 00:00:00','yyyy-MM-dd HH24:MI:ss')