DateDiff Function
Syntax
DateDiff(interval, dateexpr1, dateexpr2)
Group
Description
Returns the number of intervals between two dates
Parameters
| Parameters | Description |
|---|---|
| interval | Indicates which kind of interval to subtract. |
| dateexpr1 | Calculates the interval from this date value to dateexpr2. If this value is Null, Null is returned. |
| dateexpr2 | Calculates the interval from dateexpr1 to this date value. If this value is Null, Null is returned. |
| Interval | Description |
|---|---|
| yyyy | Year |
| q | Quarter |
| m | Month |
| y | Day of year |
| d | Day |
| w | Weekday |
| ww | Week |
| h | Hour |
| n | Minute |
| q | Second |
See also
Sub Main Debug.Print DateDiff("yyyy",#1/1/1990#,#1/1/2000#) ' 10 End Sub