The test code is as follows, please run this example using IE
Copy Code code as follows:
<script language= "VBScript" >
D=now
Xqj=weekday (d)
MsgBox Xqj ' output number, Sunday is 1, Monday is 2 ... By analogy, Saturday is 7.
MsgBox WeekdayName (XQJ)
</script>
Weekday Purpose: Returns the number of weeks of a date. By default, its value is an integer between 1 (Sunday) and 7 (Saturday).
Weekday is a function in Visual Basic and VBS that returns an integer representing the day of the week.
Grammar
Copy Code code as follows:
Dim x
X=weekday (Date[,firstdayofweek])
Parameters
The syntax for the weekday function has the following parameters:
Parameters |
Describe |
Date |
Must be selected. An arbitrary expression that can represent a date.
If NULL is included in the date argument, NULL is returned
|
FirstDayOfWeek |
Optional. Specifies the constant for the first day of the week.
If omitted, default uses Vbsunday
|
Parameter Setting value
The FirstDayOfWeek parameter has the following settings:
Constant |
Value |
Describe |
Vbusesystem |
0 |
Use the regional language Support (NLS) API settings |
Vbsunday |
1 |
Sunday |
Vbmonday |
2 |
Monday |
Vbtuesday |
3 |
Tuesday |
Vbwednesday |
4 |
Wednesday |
Vbthursday |
5 |
Thursday |
Vbfriday |
6 |
Friday |
Vbsaturday |
7 |
Saturday |
The Weekday function returns the following values:
Constant |
Value |
Describe |
Vbsunday |
1 |
Sunday |
Vbmonday |
2 |
Monday |
Vbtuesday |
3 |
Tuesday |
Vbwednesday |
4 |
Wednesday |
Vbthursday |
5 |
Thursday |
Vbfriday |
6 |
Friday |
Vbsaturday |
7 |
Saturday |
WeekdayName is used to return a string representing the day of the week.
Grammar
WeekdayName (Weekday, abbreviate, FirstDayOfWeek)
The WeekdayName function syntax has the following parts:
Weekday is required. A numeric value that represents the day of the week. The numeric value depends on the setting value in the FirstDayOfWeek setting.
Abbreviate is optional. A Boolean value that indicates whether the name of the week is abbreviated. If this value is omitted, the default value is False, indicating that the name of the week cannot be abbreviated.
FirstDayOfWeek is optional. A numeric value that represents the first day of the week. See the "Set Values" section for their values.
The FirstDayOfWeek parameter values are as follows:
Constant numerical description
Vbusesystem 0 Sets the value using the native language support (NLS) API.
Vbsunday 1 week day (default).
Vbmonday 2 weeks A
Vbtuesday 3 week Two
Vbwednesday 4 week Three
Vbthursday 5 week Four
Vbfriday 6 Friday
Vbsaturday 7 Saturday