round() 与 trunc()

开发工具与关键技术:PLSQL Developer
作者:梁添荣
撰写时间:2019-4-8

–最近的意思:如果时间过半,则入,否舍

 --例:如果当前月天数过半,则四舍五入到下个月1号,否则返回这个月1号
 
 --最近月
 round(sysdate,'month');
 
 --最近零点的日期,24小时是否过半,是进1,否当天日期零点
 round(sysdate)
 
 --最近星期日的日期,七天是否过半
 round(sysdate,'day')
 
 --最近年的日期,365或366是否过半
 round(sysdate,'year')
 
 --当前年的日期是什么,就取当前年的第一天的日期
 trunc(to_date('11-12月-19'),'year')
 
 --当前月的日期是什么,就取当前月的第一天的日期
 trunc(to_date('11-12月-19'),'month')

round() 与 trunc()

相关文章:

  • 2022-12-23
  • 2021-06-28
  • 2022-12-23
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
相关资源
相似解决方案