How to Use the datediff function in VB
Datediff (interval, date1, date2 [, firstweekofyear [, firstweekofyear])
Returns the value of variant (long), indicating the number of time intervals between two specified days.
Interval: Set the unit of Period Calculation between two dates. For example,>Interval= "M" indicates that the calculation unit is month. >IntervalSuch:
Yyyy> year
Q quarter
M month
D Day
W weekday
H hour
N minute points
S second seconds
Date1, date2: Two date expressions in the calculation period. If> date1 is earlier, the period result between two dates is positive. If> date2 is earlier, the result is negative.
Firstweekofyear: Set the first day of a week to the day of a week. If not set, it indicates Sunday. > The FW setting value is as follows:
0 usage> API setting value.
1 Sunday
2 Monday
3 Tuesday
4. Wednesday
Friday
6 Friday
7. Saturday
Firstweekofyear: Set the first week of the year. If not specified, the week of January 1, January 1 is the first week of the year. > The FY value is as follows:
0 usage> API setting value.
1. The week of January 1, January 1 is the first week of the year.
2. The first week of at least four days is the first week of a year.
3 contains the first week of seven days as the first week of a year
The proportions are as follows:
Calculate the number of months between two dates.
Diffmonthl = datediff ("M", date_start, date_end)
========================================================== ======================================