round日期函数 天数如何四舍五入

来源:互联网 发布:最新网络盗刷 编辑:程序博客网 时间:2024/04/29 11:02
--讲解:年份按**1-6月和7-12月**四舍五入到最近的 几几年1月1日select round(to_date('6-2月-13'),'year') from dual;select round(to_date('6-5月-13'),'year') from dual;select round(to_date('6-7月-13'),'year') from dual;--讲解:月份按**1-15日和16-30日**四舍五入到最近的  几月1日select round(to_date('15-2月-13'),'month') from dual;select round(to_date('16-2月-13'),'month') from dual;--讲解:天数按**周一-周三和周四到周日**四舍五入到最近的  周日--去掉注释不然会有错误测试:select round(to_date('3-2月-13'),'day') from dual;--周日select round(to_date('4-2月-13'),'day') from dual;--周一select round(to_date('5-2月-13'),'day') from dual;--周二select round(to_date('6-2月-13'),'day') from dual;--周三以上都是2月3日 以下都是2月10日select round(to_date('7-2月-13'),'day') from dual;--周四select round(to_date('8-2月-13'),'day') from dual;--周五select round(to_date('9-2月-13'),'day') from dual;--周六select round(to_date('10-2月-13'),'day') from dual;--周日
0 0
原创粉丝点击