為什么8月31號-6月30日=2
8月30日-6月30號也=2
uj5u.com熱心網友回復:
天數/30,是一個小數來著uj5u.com熱心網友回復:
這個函式,結合 add_months 一起來學比如
add_months(‘2019-02-28’,1)
add_months(‘2019-02-27’,1)
uj5u.com熱心網友回復:
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.uj5u.com熱心網友回復:
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.uj5u.com熱心網友回復:
四樓和三樓的結論一樣,后幾天、沒太懂!!我又看了一下,只有date1為月底是30號時才會出現這種情況,月底為31號時,后面日期30號為整,31號取30還是小時,這個函式根據第一個引數來判定計算后面的日期,不知道說的對不對?望指教uj5u.com熱心網友回復:
天數數字相同或者同為各自月份的最后一天,回傳整數。否則以31為基準,通過天數差來計算小數。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/29760.html
標籤:開發
