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:  3

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:  Wednesday

< Back to ASP Scripts