Weekday

Return the day of the week.

Syntax 
      Weekday(Date [,FirstDayofWeek])

Key
   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)

Example

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:

DateAdd - Add a time interval to a Date
DateDiff
- Return the time interval between two dates
DatePart
- 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 © SS64.com 1999-2019
Some rights reserved