为什么8月31号-6月30日=2
            8月30日-6月30号也=2

解决方案 »

  1.   

    这个函数,结合 add_months 一起来学比如add_months(‘2019-02-28’,1)  add_months(‘2019-02-27’,1)  
      

  2.   

    MONTHS_BETWEEN returns number of months between dates date1 and date2. The month and the last day of the month are defined by the parameter NLS_CALENDAR. 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.
      

  3.   

    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.
      

  4.   

    四楼和三楼的结论一样,后几天、没太懂!!我又看了一下,只有date1为月底是30号时才会出现这种情况,月底为31号时,后面日期30号为整,31号取30还是小时,这个函数根据第一个参数来判定计算后面的日期,不知道说的对不对?望指教