Table of contents
TOC
Collapse the table of content
Expand the table of content

Weekday Function

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Returns a Variant ( Integer ) containing a whole number representing the day of the week. SyntaxWeekday(date, [ firstdayofweek ] ) The Weekday function syntax has thesenamed arguments:

PartDescription
dateRequired. Variant, numeric expression, string expression, or any combination, that can represent a date. If date containsNull, Null is returned.
firstdayofweekOptional. A constant that specifies the first day of the week. If not specified, vbSunday is assumed.

Settings The firstdayofweek argument has these settings:

ConstantValueDescription
vbUseSystem0Use the NLS API setting.
vbSunday1Sunday (default)
vbMonday2Monday
vbTuesday3Tuesday
vbWednesday4Wednesday
vbThursday5Thursday
vbFriday6Friday
vbSaturday7Saturday

Return Values The Weekday function can return any of these values:

ConstantValueDescription
vbSunday1Sunday
vbMonday2Monday
vbTuesday3Tuesday
vbWednesday4Wednesday
vbThursday5Thursday
vbFriday6Friday
vbSaturday7Saturday

Remarks If the Calendar property setting is Gregorian, the returned integer represents the Gregorian day of the week for the date argument. If the calendar is Hijri, the returned integer represents the Hijri day of the week for the date argument. For Hijri dates, the argument number is any numeric expression that can represent a date and/or time from 1/1/100 (Gregorian Aug 2, 718) through 4/3/9666 (Gregorian Dec 31, 9999).

Example

This example uses the Weekday function to obtain the day of the week from a specified date.

Dim MyDate, MyWeekDay
MyDate = #February 12, 1969#    ' Assign a date.
MyWeekDay = Weekday(MyDate)    ' MyWeekDay contains 4 because 
    ' MyDate represents a Wednesday.
© 2017 Microsoft