Oracle to_char 日期转换字符串语句分享(2)
2.查询某周的最后一天 select trunc(decode(ww, 53, to_date(yy || '3112', 'yyyyddmm'), to_date(yy || '-' || to_char(ww * 7), 'yyyy-ddd')), 'd') - 6 first_day from (select substr('2004-33', 1, 4)
2.查询某周的最后一天
select trunc(decode(ww, 53, to_date(yy || '3112', 'yyyyddmm'), to_date(yy || '-' || to_char(ww * 7), 'yyyy-ddd')), 'd') - 6 first_day from (select substr('2004-33', 1, 4) yy, to_number(substr('2004-33', 6)) ww from dual) select trunc(to_date(substr('2003-01',1,5)||to_char((to_number(substr('2003-01',6)))*7),'yyyy-ddd'),'d') last_day from dual select max(v_date) from (select (to_date('200408','yyyymm') + rownum) v_date from all_tables where rownum < 370) where to_char(v_date,'yyyy-iw') = '2004-33'
收藏文章
精彩图集
精彩文章