VBScript WeekDay Function
Table of content
VBScript WeekDay() :
VBScript WeekDay() returns an integer from 1 to 7 which represents the day of the week for the specified date.
Syntax
Weekday(date[,firstDayOfWeek])
Parameter Description
Parameter Description :
| Parameter | Required | Explanation |
|---|---|---|
| Date | Yes | Parameter specifies the date whose week day need to evaluate |
| firstDayOfWeek | No | Specifies the first day of the week. |
Below are possible values of firstDayOfWeek parameter -
| firstDayOfWeek Code | String Rep | Explanation |
|---|---|---|
| 0 | vbUseSystemDayOfWeek | Use National Language Support |
| 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("Ex 1: " & Weekday("2025-01-11",1) & "<br />") document.write("Ex 2: " & Weekday("2025-01-11",2) & "<br />") document.write("Ex 4: " & Weekday("2025-01-11") & "<br />") </script> </body> </html>
Output :
After running above script in IE we will get following output -
Ex 1: 7 Ex 2: 6 Ex 4: 7
