WeekDay Function

 
Tips >>ASP Functions

WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE


The Weekday function returns a number between 1 and 7, that represents the day of the week. It returns a whole number representing the day of the week.

There is One Mandatory Argument :-

  • Date :- The Date argument is any valid date expression and you may use the Date and Now functions.

There is One Optional Argument :-

  • FirstDayofWeek :- The optional FirstDayofWeek argument must only use the constants or values defined above in the Date And Time Constants. In this example, Monday is defined to be the first day of the week. Therefore, Saturday becomes 6.

The Syntax of the WeekDay function is :-

Weekday(date[,firstdayofweek])

The Weekday function can return any of these values :-

CONSTANT VALUE DESCRIPTION
VBSunday 1 Sunday
VBMonday 2 Monday
VBTuesday 3 Tuesday
VBWednesday 4 Wednesday
VBThursday 5 Thursday
VBFriday 6 Friday
VBSaturday 7 Saturday
VBFirstJan1 1 Week of January 1
VBFirstFourDays 2 First week of the year that has at least four days
VBFirstFullWeek 3 First full week of the year
VBUseSystem 0 Use the date format of the computer's regional settings
VBUseSystemDayOfWeek 0 Use the first full day of the week as defined by the system settings

Example#1 :-

Code :-
document.write(Date & "<br />")
document.write(Weekday(Date))
Output :-
1/15/2002
3

Example#2 :-

Code :-
Dim MyDate, MyWeekDayMyDate = #October 19, 1962# '
Assign a date.MyWeekDay = Weekday(MyDate) '
Output :-
MyWeekDay contains 6
Because, MyDate represents a Friday.

Example#3 :-
It explains the Date Argument

Code :-
<%
=WeekDay(May 23, 2006)
%>
Output :-
3

Example#4 :-
It explains the Firstdayofweek Argument

Code :-
<%
=WeekDay("6/26/1943", VBMonday)
%>
Output :-
6

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641