LibreOffice 25.2 帮助
Returns the number of date or time intervals between two given date values.
DateDiff (interval As String, date1 As Date, date2 As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Double
数字。
interval - A string expression from the following table, specifying the date or time interval.
date1, date2 - The two date values to be compared.
firstdayofweek: An optional parameter that specifies the starting day of a week.
| firstdayofweek value | 解释 | 
|---|---|
| 0 | 使用系统默认值 | 
| 1 | 星期日 (默认) | 
| 2 | 星期一 | 
| 3 | 星期二 | 
| 4 | 星期三 | 
| 5 | 星期四 | 
| 6 | 星期五 | 
| 7 | 星期六 | 
firstweekofyear: An optional parameter that specifies the starting week of a year.
| firstweekofyear value | 解释 | 
|---|---|
| 0 | 使用系统默认值 | 
| 1 | 第 1 周是包含 1 月 1 日的周 (默认) | 
| 2 | 第 1 周是含有当年 4 天以上天数的第 1 周 | 
| 3 | 第 1 周是仅包含属于新一年的那几天的第 1 周 | 
Sub example_datediff
    MsgBox DateDiff("d", #1/1/2005#, #2005-12-31#)
End Sub