Oracle PL/SQL之NEXT_DAY - 取得下一個星期幾所在的日期 |
發(fā)布時間: 2012/8/27 17:39:02 |
NEXT_DAY(date,char):返回指定日期(由date指定)后的第一個星期幾(由char指定)所在的日期,char也可用1~7替代,1表示星期日。 1.duzz$scott@orcl>select sysdate,to_char(sysdate,'day') weekday,next_day(sysdate,1) n_day,to_char(next_day(sysdate,1),'day') n_weekday from dual; 2. 3.SYSDATE WEEKDAY N_DAY N_WEEKDAY 4.------------------- ---------- -------------------- ---------- 5.2011-08-22 23:01:18 monday 2011-08-28 23:01:18 sunday 6. 7.Elapsed: 00:00:00.00 8.duzz$scott@orcl>select sysdate,to_char(sysdate,'day') weekday,next_day(sysdate,2) n_day,to_char(next_day(sysdate,2),'day') n_weekday from dual; 9. 10.SYSDATE WEEKDAY N_DAY N_WEEKDAY 11.------------------- ---------- -------------------- ---------- 12.2011-08-22 23:04:26 monday 2011-08-29 23:04:26 monday 13. 14.Elapsed: 00:00:00.00 15.duzz$scott@orcl>select sysdate,to_char(sysdate,'day') weekday,next_day(sysdate,3) n_day,to_char(next_day(sysdate,3),'day') n_weekday from dual; 16. 17.SYSDATE WEEKDAY N_DAY N_WEEKDAY 18.------------------- ---------- -------------------- ---------- 19.2011-08-22 23:04:55 monday 2011-08-23 23:04:55 tuesday 20. 21.Elapsed: 00:00:00.00 22.duzz$scott@orcl>select sysdate,to_char(sysdate,'day') weekday,next_day(sysdate,'monday') n_day,to_char(next_day(sysdate,'monday'),'day') n_weekday from dual; 23. 24.SYSDATE WEEKDAY N_DAY N_WEEKDAY 25.------------------- ---------- -------------------- ---------- 26.2011-08-22 23:08:16 monday 2011-08-29 23:08:16 monday 27. 28.Elapsed: 00:00:00.00 29.duzz$scott@orcl> 本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |