Welcome to my ASP Code Website

DatePart ASP Function



DatePart lets you examine a date variable and see any particular part of it. The format is:

DatePart(type, date)

The types can be:

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

So if you had CurrDate equal to 4/1/2007 and did:

CurrMonth = DatePart("m", CurrDate)

CurrMonth would return 4.


ASP Date and Time Functions