oracle函数...
时间:2010-08-17 来源:heyuanjia520
--1.上月末天:
select to_char(add_months(last_day(sysdate),-1),'YYYY-MM-DD HH24:mi:ss') LastDay from dual;
--2.上月今天
select to_char(add_months(sysdate,-1),'YYYY-MM-DD HH24:mi:ss') PreToday from dual;
--3.上月首天
select to_char(add_months(last_day(sysdate)+1,-2),'YYYY-MM-DD HH24:mi:ss') firstDay from dual;
--4.要找到某月中所有周五的具体日期
SELECT to_char(b.a,'YYYY-MM-DD')
FROM ( SELECT trunc(SYSDATE,'mm')+ROWNUM-1 a
FROM dba_objects where rownum < 32 ) b
WHERE to_char(b.a,'day')='星期五';
相关阅读 更多 +