DatePart() extracts a requested component from a VBScript Date value, such as the month, year, weekday or week number.
DatePart(interval, date[, firstdayofweek[, firstweekofyear]])
Dim d_today
d_today = Now
Response.Write DatePart("m", d_today)
Response.Write DatePart("yyyy", #9/10/2003#)
The output is 2003.
Year(#10/15/2003#)Returns 2003.
Month(#10/15/2003#)Returns 10.
Day(#10/15/2003#)Returns 15.
w or ww, specify firstdayofweek and firstweekofyear when your application requires a particular calendar convention instead of relying on defaults.Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.