Name
WeekdayName Function
Class
Microsoft.VisualBasic.DateAndTime
Syntax
WeekdayName(Weekday, [abbreviate [, FirstDayOfWeekValue]])-
Weekday Use: Required
Data Type: Long
The ordinal number of the required weekday, from 1 to 7
-
abbreviate Use: Optional
Data Type: Boolean
Specifies whether to return the full day name or an abbreviation
-
FirstDayOfWeekValue Use: Optional
Data Type:
FirstDayOfWeekconstantMember of the
FirstDayOfWeekenum indicating the first day of the week
Return Value
A String
Description
Returns the name of the day
Rules at a Glance
Weekdaymust be a number between 1 and 7, or the function generates an ArgumentException error.The default value of
abbreviateisFalse.For a list of the members of the FirstDayOfWeek enumeration, see the “Weekday Function” entry.
The default value of
FirstDayOfWeekValueisFirstDayOfWeek.Monday.
Programming Tips and Gotchas
Since
Weekdayis an integer, to determine the name of the day of a particular date, combineWeekDayNamewith a call to theWeekDayfunction, as the following code fragment shows:sDay = WeekDayName(Weekday(dDate, iFirstDay), _ bFullName, iFirstDay)Note that the value of the
FirstDayOfWeekargument must be the same in the calls to both functions forWeekdayNameto return an accurate result.Unlike the
Weekdayfunction, theWeekdayNamefunction behaves predictably. For example, if you ask for the name of the first day of the week when the week starts on Monday, the function returnsMonorMonday. If you ask for the fifth day ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access