DatePart
Return a unit of time from a date.
Syntax
DatePart (interval,date [, FirstDayofWeek [, FirstWeekofYear]])
Key
date The date to anaylyse
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 in 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"
WScript.Echo dtm1
intMonthsinDate=DatePart("m", dtm1)
WScript.Echo intMonthsinDate