VBScript Weekday function
May 13, 2021
VBScript
Table of contents
VBScript
Weekday
function
The VBScript Weekday function returns a value that represents the day of the week, please refer to this section for use!
Complete VBScript reference manual
The Weekday function returns a number that represents the number of days of the week, between 1 and 7.
Grammar
Weekday(date[,firstdayofweek])
Parameters
parameter
|
describe
|
date
|
Required.The date expressions to calculate.
|
firstdayofweek
|
Optional.The first day of the week.
The following value can be used:
-
0 = VbusesystemDayofweek - Using Regional Language Support (NLS) API Settings
-
1 = VBSunday - Sunday (default)
-
2 = VBMONDAY - Monday
-
3 = VBTESDAY - Tuesday
-
4 = vbwednesday - Wednesday
-
5 = VBTHURSDAY - Thursday
-
6 = VBFRIDAY - Friday
-
7 = VBSATURDAY - Saturday
|
<script type="text/vbscript">
document.write("document.write(Weekday(" & chr(34) & "2010-02-16" & chr(34) & ",0) & " & chr(34) & "<br />" & chr(34) & ")
") document.write(Weekday("2010-02-16",1) & "<br />")
document.write(Weekday("2010-02-16",2) & "<br />")
document.write(Weekday("2010-02-16",3) & "<br />")
document.write(Weekday("2010-02-16",4) & "<br />")
document.write(Weekday("2010-02-16",5) & "<br />")
document.write(Weekday("2010-02-16",6) & "<br />")
</script>
The above example output results:
document.write(Weekday("2010-02-16",0) & "
") 3
2
1
7
6
5
Try it out . . .
Complete VBScript reference manual