oracle中取得当前日期,前一天,当前月,前一个月

 

  当前日:select TRUNC(SYSDATE)  from dual;

  前一天: select TRUNC(SYSDATE - 1)   from dual;

前一天转换为日期格式: select to_char(TRUNC(sysdate-1),'fmdd')   from dual;

to_char(TRUNC(sysdate-1),'fmdd')

  前一个月日期: select add_months(trunc(sysdate),-1) from dual;

 前一个月:select TRUNC(add_months(trunc(sysdate),-1),'MM') from dual;

后一个月转换为字符串:select to_char(add_months(trunc(sysdate),1),'yyyymm') from dual;  

posted on 2017-11-08 14:17  七七2020  阅读(74030)  评论(1编辑  收藏  举报

导航