How to use DateDiff function in VB
DateDiff (interval, Date1, date2[,firstweekofyear[,firstweekofyear])
Returns a Variant (long) that represents the number of time intervals between two specified dates
interval: Sets the unit of the period calculation between two dates. For example, >interval= "m" means the calculated unit is month. >interval setting values such as:
yyyy > Year
Q Quarter season
M month
D Day
W Weekday Week
H Hour Time
n Minute min
s Second s
Date1, Date2: Two date expressions during calculation, if >date1 earlier, the period between two dates is positive, and if >date2 earlier, the result is negative.
firstweekofyear: Set the first day of the week to a few days, if not set as Sunday. The setting values for the >FW are as follows:
0 Use the Set value of the >API.
1 Sunday
2 Monday
3 Tuesday
4 Wed
5 Thu
6 Friday
7 Saturday
firstweekofyear: Set the first week of the year, if not set, it means the week of January 1 is the first week of the year. The setting values for the >fy are as follows:
0 Use the Set value of the >API.
1 January 1 that week is the first week of the year
2 contains at least four days of the first week for the first week of the year
3 contains seven day first week for first week of year
The scale is as follows:
Calculates the number of months between two dates.
DIFFMONTHL = DateDiff ("M", Date_start, Date_end)
========================================================================
Explanation of DateDiff function in VB