Share via


DateAndTime.WeekdayName Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a String value containing the name of the specified weekday.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Shared Function WeekdayName ( _
    Weekday As Integer, _
    Abbreviate As Boolean, _
    FirstDayOfWeekValue As FirstDayOfWeek _
) As String
public static string WeekdayName(
    int Weekday,
    bool Abbreviate,
    FirstDayOfWeek FirstDayOfWeekValue
)

Parameters

  • Weekday
    Type: System.Int32
    Required. Integer. The numeric designation for the weekday, from 1 through 7; 1 indicates the first day of the week and 7 indicates the last day of the week. The identities of the first and last days depend on the setting of FirstDayOfWeekValue.
  • Abbreviate
    Type: System.Boolean
    Optional. Boolean value that indicates if the weekday name is to be abbreviated. If omitted, the default is False, which means the weekday name is not abbreviated.
  • FirstDayOfWeekValue
    Type: Microsoft.VisualBasic.FirstDayOfWeek
    Optional. A value chosen from the FirstDayOfWeek enumeration that specifies the first day of the week. If not specified, FirstDayOfWeek.System is used.

Return Value

Type: System.String
Returns a String value containing the name of the specified weekday.

Remarks

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.

NoteNote:

WeekdayName uses the current calendar setting from the CurrentCulture property of the CultureInfo class in the System.Globalization namespace. The default CurrentCulture values are determined by Control Panel settings.

The FirstDayOfWeekValue argument can have one of the following settings.

Enumeration value

Value

Description

FirstDayOfWeek.System

0

First day of week specified in system settings (default)

FirstDayOfWeek.Sunday

1

Sunday

FirstDayOfWeek.Monday

2

Monday (complies with ISO standard 8601, section 3.17)

FirstDayOfWeek.Tuesday

3

Tuesday

FirstDayOfWeek.Wednesday

4

Wednesday

FirstDayOfWeek.Thursday

5

Thursday

FirstDayOfWeek.Friday

6

Friday

FirstDayOfWeek.Saturday

7

Saturday

Examples

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.

Dim oldDate As Date
Dim oldWeekDayName As String
oldDate = #2/12/1969#
oldWeekDayName = WeekdayName(Weekday(oldDate))
' oldWeekDayName now contains "Wednesday".

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.