VBScript WeekDayName function
VBScript WeekDayName
VBScript WeekDayName() function will return the name of the Weekday for the specified day.
Syntax :
WeekdayName(weekday[,abbreviate[,firstdayofweek]])
Parameter Description :
Parameter | Explanation |
---|---|
weekday | a Required Parameter. The number of the weekday |
toabbreviate | An Optional Parameter. A Boolean value Boolean value that indicates if the month name is to be abbreviated. If left blank then the default value would be taken as False. |
firstdayofweek | An Optional Parameter. Specifies the first day of the week. |
Below is list of the constants defined in VBScript for value of week days -
Code | Constant Name | Value |
---|---|---|
0 | vbUseSystemDayOfWeek | Use National Language Support (NLS) API setting |
1 | vbSunday | Sunday |
2 | vbMonday | Monday |
3 | vbTuesday | Tuesday |
4 | vbWednesday | Wednesday |
5 | vbThursday | Thursday |
6 | vbFriday | Friday |
7 | vbSaturday | Saturday |
Example
<!DOCTYPE html> <html> <body> <script language="vbscript" type="text/vbscript"> document.write("Line 1 : " & WeekdayName(6)) document.write("<br />") document.write("Line 2 : " & WeekdayName(1,True)) document.write("<br />") document.write("Line 3 : " & WeekdayName(4,False)) document.write("<br />") document.write("Line 4 : " & WeekdayName(4,True,0)) document.write("<br />") document.write("Line 5 : " & WeekdayName(2,False,1)) document.write("<br />") </script> </body> </html>
Output :
After running above script in IE we will get following output -
Line 1 : Friday Line 2 : Sun Line 3 : Wednesday Line 4 : Wed Line 5 : Monday