Syntax 

DateDiff(interval, dateexpr1, dateexpr2)


Group 

Time/Date 


Description 

Return the number of intervals between two dates. 


Parameters

Description

interval 

This string value indicates which kind of interval to subtract. 

dateexpr1 

Calculate the interval from this date value to dateexpr2. If this value is Null then Null is returned. 

dateexpr2 

Calculate the interval from dateexpr1 to this date value. If this value is Null then Null is returned. 


Interval

Description

yyyy 

Year 

Quarter 

Month 

Day of year 

Day 

Weekday 

ww 

Week 

Hour 

Minute 

Second 


See Also 

DateAdd, DatePart


Example

Sub Main

    Debug.Print DateDiff("yyyy",#1/1/1990#,#1/1/2000#) ' 10

End Sub