Welcome to my ASP Code Website

WeekdayName Date Function



To add nice, customized messages in your newsletters, website or other net uses, the WeekdayName lets you figure out the name - Sunday, Monday, etc. - of any date.

Note that the function WeekdayName does NOT work directly on a raw date. You cannot say WeekdayName(Now()) for example. Instead, you must feed WeekdayName the *id number* of the day of the week. So for Sunday you feed it 0, for Monday you feed it 1, and so on. You figure out the weeday ID number by using the Weekday function.

For example, if you want to say the word "Saturday" on your website when it's a Saturday, you would use

currdate = now()
currid = weekday(currdate)
currname = weekdayname(currid)
response.write "today is" & currname

ASP Date and Time Functions