欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oracle中月初月末的表示

程序员文章站 2022-05-15 09:15:57
...

oracle中月初月末的表示

当前日期

select to_char(add_months(sysdate,0),'yyyy-MM-dd') day from dual

上月当前日期

select to_char(add_months(sysdate,-1),'yyyy-MM-dd') day from dual 

下月当前日期

select to_char(add_months(sysdate,1),'yyyy-MM-dd') day from dual 

上月首天

select to_char(add_months(last_day(sysdate)+1,-2),'yyyy-MM-dd') day from dual 

上月月末

select to_char(last_day(add_months(last_day(sysdate)+1,-2)),'yyyy-MM-dd') day from dual 

当月首天

select to_char(add_months(last_day(sysdate)+1,-1),'yyyy-MM-dd') day from dual 

当月月末

select to_char(last_day(add_months(last_day(sysdate)+1,-1)),'yyyy-MM-dd') day from dual

下月首天

select to_char(add_months(last_day(sysdate)+1,0),'yyyy-MM-dd') day from dual

下月月末

select to_char(last_day(add_months(last_day(sysdate)+1,0)),'yyyy-MM-dd') day from dual
相关标签: oracle oracle