LibreOffice 25.2 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
Một con số.
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 | Giải thích | 
|---|---|
| 0 | Dùng giá trị mặc định của hệ thống | 
| 1 | Chủ Nhật (mặc định) | 
| 2 | Thứ Hai | 
| 3 | Thứ Ba | 
| 4 | Thứ Tư | 
| 5 | Thứ Năm | 
| 6 | Thứ Sáu | 
| 7 | Thứ Bảy | 
firstweekofyear: An optional parameter that specifies the starting week of a year.
| firstweekofyear value | Giải thích | 
|---|---|
| 0 | Dùng giá trị mặc định của hệ thống | 
| 1 | Tuần 1 là tuần chứa ngày 1, tháng 1 (mặc định) | 
| 2 | Tuần 1 là tuần thứ nhất chứa ít nhất bốn ngày của năm đó. | 
| 3 | Tuần 1 là tuần thứ nhất chứa chỉ những ngày của năm mới. | 
Sub example_datediff
    MsgBox DateDiff("d", #1/1/2005#, #2005-12-31#)
End Sub