VBScript WeekdayNameFunction


VBScript 参考手册Complete VBScript Reference Manual

The WeekdayName function returns the weekday name for a specified day of the week.

Syntax

WeekdayName(weekday[,abbreviate[,firstdayofweek]])

Parameters Description
weekday Required. A number representing the day of the week.
abbreviate Optional. A Boolean value indicating whether the weekday name is abbreviated.
firstdayofweek Optional. Specifies the first day of the week.

Can take the following values:

  • 0 = vbUseSystemDayOfWeek - Uses the National Language Support (NLS) API setting
  • 1 = vbSunday - Sunday (default)
  • 2 = vbMonday - Monday
  • 3 = vbTuesday - Tuesday
  • 4 = vbWednesday - Wednesday
  • 5 = vbThursday - Thursday
  • 6 = vbFriday - Friday
  • 7 = vbSaturday - Saturday

Examples

Example 1

Get the name of the 3rd day of the week:

<script type="text/vbscript">

document.write(WeekdayName(3))

</script>

The output result of the above example:

Tuesday

Try it yourself »

Example 2

Get the abbreviated name of the 3rd day of the week:

<script type="text/vbscript">

document.write(WeekdayName(3,True))

</script>

The output result of the above example:

Tue

Try it yourself »

Example 3

Get the name of the 3rd day of the week, with Monday as the first day of the week:

<script type="text/vbscript">

document.write(WeekdayName(3,False,2))

</script>

The output result of the above example:

Wednesday

Try it yourself »


VBScript 参考手册Complete VBScript Reference Manual Other extensions