Weekday Function (Visual Basic)
Returns an Integer value containing a number representing the day of the week.
Public Function Weekday( _ ByVal DateValue As DateTime, _ Optional ByVal DayOfWeek As FirstDayOfWeek = FirstDayOfWeek.Sunday _ ) As Integer
The DayOfWeek argument can have one of the following settings.
First day of week specified in system settings
Monday (complies with ISO standard 8601, section 3.17)
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 value returned by the Weekday function is the day of the week that the DateValue corresponds to, relative to the first day of the week defined by the DayOfWeek value. For example, if the date refers to a Wednesday and the first day of the week is specified as Monday, the function returns 3.
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)