Tuesday, 29 November 2011

DISPLAY DAY OF WEEK

There are a number of ways that 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 / VBScript:


Printer Friendly Page


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




This script displays the current month number like this: 4

If you want to display the name of a month, you can use this code:


Printer Friendly Page


<% DIM iDay 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 month name like this: Wednesday

http://www.aspwebpro.com/aspscripts/dates/dayofweek.asp

No comments:

Post a Comment