VBScript WeekDay Function

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 :

ParameterRequiredExplanation
DateYesParameter specifies the date whose week day need to evaluate
firstDayOfWeekNoSpecifies the first day of the week.

Below are possible values of firstDayOfWeek parameter -

firstDayOfWeek CodeString RepExplanation
0vbUseSystemDayOfWeekUse National Language Support
1vbSundaySunday
2vbMondayMonday
3vbTuesdayTuesday
4vbWednesdayWednesday
5vbThursdayThursday
6vbFridayFriday
7vbSaturdaySaturday

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