Return the day of the week.

      Weekday(Date [,FirstDayofWeek])

   Date             A date expression

   FirstDayofWeek   A constant that specifies
                    the first day of the week, default=vbSunday.

To create day numbers compatible with ISO 8601 standard dates, set thefirstdayofweek to Monday(2 or vbMonday)


Dim intDay
intDay = Weekday("30/04/2012",2)
WScript.Echo intDay
> 1 Weekday() will return one of the following constant values: vbSunday 1 vbMonday 2 vbTuesday 3 vbWednesday 4 vbThursday 5 vbFriday 6 vbSaturday 7

“Write it on your heart that every day is the best day in the year” ~ Ralph Waldo Emerson

Related VBScript commands

DateAdd - Add a time interval to a Date.
- Return the time interval between two dates.
- Return a unit of time from a date.
WeekdayName - Return the named day of the week.
Equivalent PowerShell cmdlet: (Get-Date).DayOfWeek.Value__ + 1 (The underscores give a number and the +1 is because PS counts from 0)

Copyright © 1999-2023 SS64.com
Some rights reserved