执行select sysdate from dual;得到当前日期为:2014/4/30 14:11:33  星期三

select  next_day(sysdate,'星期日') from dual;

得到日期为:2014/5/4 14:12:53

从这个礼拜三到得到礼拜天的日期数

如果执行select  next_day(sysdate,'星期日') from dual;

得到日期为2014/5/6 14:14:31,即从这个礼拜三得到下个礼拜二的日期数,而不是这个礼拜二的日期数

 

因此next_day(sysdate,'XXXX')函数的作用为,从当前日期开始得到到未来  星期数  的日期。

 

select next_day(to_date('2014-4-1','yyyy-MM-dd'),'星期三') from dual;

从特定日期得到之后的第一个星期几的日期。

相关文章:

  • 2021-12-11
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-08
  • 2021-07-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2021-10-20
  • 2022-03-10
相关资源
相似解决方案