Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

Weekday

The Weekday function calculates the day of the week for any given date. The only required parameter is a Date or Datetime expression that the function should return the day of the week for. The day of the week ranges from 1 to seven and corresponds to the following values:

Constant Value Meaning
vbSunday 1 Sunday
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday


The second parameter is an optional parameter which indicates which day of the week you are using as the first day of the week. Be default, the function will use Sunday as the first day of the week.

Dim dDate
dDate = Now()
' build the weekday based on the default setting Response.Write "Weekday is: " & Weekday(dDate) & "<BR>"
Response.Write "Weekday Name is: " & WeekdayName(Weekday(dDate)) & "<BR>"

' build the weekday based on first day of monday Response.Write "Weekday is: " & Weekday(dDate, vbMonday) & "<BR>"
Response.Write "Weekday Name is: " & WeekdayName(Weekday(dDate, vbMonday)) & "<BR>"


This method is very useful for displaying the current day-of-the-week and also for building a calendar application. You can retrieve individual parts of a date using the Year, Month and Day functions as well as the DatePart function.

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"Life is wasted on the living." - Douglas Adams

©2007 Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.