1.获取时间的日:
select to_char(sysdate,’dd’) as nowday from dual
2. –获取时间的时:
select to_char(sysdate,’hh24’) as nowhour from dual;
3.–获取时间的分:
select to_char(sysdate,’mi’) as nowminute from dual;
4.–获取时间的秒:
select to_char(sysdate,’ss’) as nowsecond from dual;
5.–当前星期几
select to_char(sysdate,’day’) from dual;
6.–本周整周日期(以周日为第一天算)
select trunc(sysdate,’d’), trunc(sysdate,’d’)+7 from dual;
7.–下周开始日期
select trunc(sysdate,’d’)+7 from dual;
下周整周日期
select trunc(sysdate,’d’)+7,trunc(sysdate,’d’)+14 from dual;
8.–本月开始日期
select trunc(sysdate,’mm’) from dual;
9.–本月结束日期
select last_day(trunc(sysdate))from dual;
10.–下个月开始日期
select add_months(trunc(sysdate, ‘mm’), 1) from dual;
11.–本季开始日期
select trunc(sysdate,’Q’)from dual;
12–本年开始日期
select trunc(sysdate,’yyyy’) from dual;
13–本年结束日期
select add_months(trunc(sysdate,’yyyy’),12)-1 from dual;
14.
select to_char(sysdate, ‘iw’) as week, –今年已过周
to_char(sysdate, ‘ww’) as week2, –周
to_char(sysdate, ‘ddd’) as day, –今年已过天
to_char(sysdate, ‘q’) as quarter – 今年已过季度
from dual;
作者:java_mmt_sayno
来源:优快云
原文:https://blog.youkuaiyun.com/java_mmt/article/details/81868826
版权声明:本文为博主原创文章,转载请附上博文链接!