免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1675 | 回复: 1
打印 上一主题 下一主题

日期是怎么计算的,关于months_between()? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-05-22 13:57 |只看该作者 |倒序浏览
select months_between('22-jul-2003','21-may-2003') from dual;
result:2.03225806
select months_between('21-may-2003','22-jul-2003') from dual;
result: -2.0322581
这两个结果的绝对值不同,如果the first date later than the last one
result=date1-date2
如果the first date earlier than the last one
result=?

论坛徽章:
0
2 [报告]
发表于 2003-05-22 15:26 |只看该作者

日期是怎么计算的,关于months_between()?

这是显示时的舍入误差,实际上是一样的。
set numformat 9.00000000000000000000000000000000000
alter session set nls_date_format = 'yyyy-mm-dd';

select months_between('2003-05-22','2003-04-21') from dual;
select months_between('2003-04-21','2003-05-22') from dual;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP