LibreOffice 24.8 Help
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 天以上的那一週 | 
| 3 | 第 1 週是包含 1 月 1 日的那一週 | 
Sub example_datediff
    MsgBox DateDiff("d", #1/1/2005#, #2005-12-31#)
End Sub