Oracle计算时间函数(numtodsinterval、numtoyminterval)
程序员文章站
2023-01-22 19:04:52
numtodsinterval(<数字>,<字符串>) 字符串包含('day','hour','minute','second') select sysdate,sysdate+numtodsinterval(3,'day') as res from dual; --取三天后的时间 select s ......
numtodsinterval(<数字>,<字符串>)
字符串包含('day','hour','minute','second')
select sysdate,sysdate+numtodsinterval(3,'day') as res from dual; --取三天后的时间
select sysdate,sysdate+numtodsinterval(3,'hour') as res from dual;--取三小时后的时间
select sysdate,sysdate+numtodsinterval(3,'minute') as res from dual; --取三分钟后的时间
select sysdate,sysdate+3/24 as res from dual --取三分钟后的时间 需换算
select sysdate,sysdate+numtodsinterval(3,'second') as res from dual; --取三秒后的时间
numtodsinterval(<数字>,<字符串>)
字符串包含('year','month')
select sysdate,sysdate+numtoyminterval(3,'year') as res from dual; --取三年后的时间
select sysdate,sysdate+numtoyminterval(-3,'month') as res from dual;--取三月前的时间