DateDiff

Return the time interval between two dates.
Syntax
DateDiff (interval,date1,date2[, FirstDayofWeek [, FirstWeekofYear]])

Key
date1 The first date to compare

date2 The second date to compare

FirstDayofWeek A constant defining the first day of the week:
vbUseSystem (0), vbSunday (1=default),vbMonday(2),
vbTuesday(3), vbWednesday(4), vbThursday(5),
vbFriday(6), vbSaturday(7)

FirstWeekofYear A constant defining the first week of the year:
vbUseSystem(0), vbFirstJan1(1),vbFirstFourDays(2),
vbFirstFullWeek(3)

interval The date/Time interval to express the result:

yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
h Hour
n Minute
s Second

Example
dtm1="18-Feb-10"
dtm2="19-Aug-10"
WScript.Echo "Difference between " & dtm1 & " and " & dtm2
intMonthsDifferent=DateDiff("m", dtm1, dtm2)
WScript.Echo intMonthsDifferent 

Make a Free Website with Yola.