months_between
select months_between(to_date('2011-4-28','yyyy-MM-dd'),to_date('2011-2-28','yyyy-MM-dd'))from dual;
MONTHS_BETWEEN(TO_DATE('2011-4
------------------------------
2
select months_between(to_date('2011-4-29','yyyy-MM-dd'),to_date('2011-2-28','yyyy-MM-dd'))
from dual;
MONTHS_BETWEEN(TO_DATE('2011-4
------------------------------
2.03225806451613
select months_between(to_date('2011-4-30','yyyy-MM-dd'),to_date('2011-2-28','yyyy-MM-dd'))
from dual;
MONTHS_BETWEEN(TO_DATE('2011-4
------------------------------
2
2011-4-30日期大于2011-4-29,按理说第三个结果应该大于第二个结果,但是结果却是相反的。
后来查阅了oracle的官方文档,是这样解释的:(小数部分是按照一个月31天计算的)
MONTHS_BETWEEN returns number of months between dates date1 and date2. If date1 is later than date2, then the result is positive. If date1 is earlier than date2, then the result is negative. If date1 and date2 are either the same days of the month or both last days of months, then the result is always an integer. Otherwise Oracle Database calculates the fractional portion of the result based on a 31-day month and considers the difference in time components date1 and date2.
select 1/31 from dual;
1/31
----------
0.03225806
这样就能解释了。
转自 http://blog.sina.com.cn/s/blog_62e7fe6701014wtk.html
相关阅读
原文地址:http://blog.csdn.net/zz709196484/article/details/54770017 注:exit()就是退出,传入的参数是程序退出时的状态码,0表示
windows系统API中CreateWindow函数窗口的风格
strcpy()函数是C语言中的一个复制字符串的库函数,以下将详细解释说明一下: · 函数声明以及实现代码 char *strcpy(char *dst, co
我是想用canvas实现一个进度条,用到这个定时器setInterval,但是调用的函数只执行了一次。定义:setInterval() 方法可按照指定的周期(
gets()和puts()函数:gets()函数的简单易用,它读取整行输入,直至遇到换行符,然后丢弃换行符,储存其余字符,并在这些字符的末尾添加一个空