Display Day of Week

You can display the day of the week # or day of the week name on your web pages.  Here are two quick ways to do it with ASP and VBScript:

<% Response.Write DatePart("w", Date()) %>

This script displays the current day of the week number like this:  1

If you want to display the day name, you can use this code:

<%
DIM iDay, strDayName
iDay = DatePart("w", Date())

SELECT CASE iDay
Case "1" strDayName = "Sunday"
Case "2" strDayName = "Monday"
Case "3" strDayName = "Tuesday"
Case "4" strDayName = "Wednesday"
Case "5" strDayName = "Thursday"
Case "6" strDayName = "Friday"
Case "7" strDayName = "Saturday"
END SELECT

Response.Write strDayName
%>

This script displays the day name like this:  Monday

< Back to ASP Scripts