Oracle查询日期
生活随笔
收集整理的這篇文章主要介紹了
Oracle查询日期
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
--基礎(chǔ)語句
select add_months(last_day(sysdate)+1,0) from dual;
select last_day(sysdate) from dual;
--組合效果
-- 當前日期
select add_months(sysdate,0) 當前日期 from dual;
-- 上月當前日期
select add_months(sysdate,-1) 上月當前日期 from dual;
-- 下月當前日期
select add_months(sysdate,1) 下月當前日期 from dual;
-- 上月首天
select add_months(last_day(sysdate)+1,-2) 上月首天 from dual;
-- 上月月末
select last_day(add_months(sysdate,-1)) 上月月末 from dual;
-- 當月首天
select add_months(last_day(sysdate)+1,-1) 當月首天 from dual;
-- 當月月末
select last_day(sysdate) 當月月末 from dual;
-- 下月首天
select add_months(last_day(sysdate)+1,0) 下月首天 from dual;
-- 下月月末
select add_months(last_day(sysdate),1) 下月月末 from dual;
select add_months(last_day(sysdate)+1,0) from dual;
select last_day(sysdate) from dual;
--組合效果
-- 當前日期
select add_months(sysdate,0) 當前日期 from dual;
-- 上月當前日期
select add_months(sysdate,-1) 上月當前日期 from dual;
-- 下月當前日期
select add_months(sysdate,1) 下月當前日期 from dual;
-- 上月首天
select add_months(last_day(sysdate)+1,-2) 上月首天 from dual;
-- 上月月末
select last_day(add_months(sysdate,-1)) 上月月末 from dual;
-- 當月首天
select add_months(last_day(sysdate)+1,-1) 當月首天 from dual;
-- 當月月末
select last_day(sysdate) 當月月末 from dual;
-- 下月首天
select add_months(last_day(sysdate)+1,0) 下月首天 from dual;
-- 下月月末
select add_months(last_day(sysdate),1) 下月月末 from dual;
總結(jié)
以上是生活随笔為你收集整理的Oracle查询日期的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VBS中MSGBOX用法
- 下一篇: Five in a row