WeekdayName Function (Visual Basic)
Returns a String value containing the name of the specified weekday.
Public Function WeekdayName( _ ByVal Weekday As Integer, _ Optional ByVal Abbreviate As Boolean = False, _ Optional ByVal FirstDayOfWeekValue As FirstDayOfWeek = FirstDayOfWeek.System _ ) As String
The FirstDayOfWeekValue argument can have one of the following settings.
First day of week specified in system settings (default)
Monday (complies with ISO standard 8601, section 3.17)
Weekday is less than 1 or greater than 7, or FirstDayOfWeekValue is less than 0 or greater than 7.
See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.
The string returned by WeekdayName depends not only on the input arguments, but also on the Regional Options settings specified in the Windows Control Panel.
The following example uses the Weekday function to obtain the day of the week from a specified date, and then the WeekDayName function to obtain the name of the weekday from its number.
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)