DateAndTime.Weekday(DateTime, FirstDayOfWeek) DateAndTime.Weekday(DateTime, FirstDayOfWeek) DateAndTime.Weekday(DateTime, FirstDayOfWeek) Method

Definición

Devuelve un valor Integer que contiene un número que representa el día de la semana.Returns an integer value containing a number representing the day of the week.

public static int Weekday (DateTime DateValue, Microsoft.VisualBasic.FirstDayOfWeek DayOfWeek = Microsoft.VisualBasic.FirstDayOfWeek.Sunday);
static member Weekday : DateTime * Microsoft.VisualBasic.FirstDayOfWeek -> int
Public Function Weekday (DateValue As DateTime, Optional DayOfWeek As FirstDayOfWeek = Microsoft.VisualBasic.FirstDayOfWeek.Sunday) As Integer

Parámetros

DateValue
DateTime DateTime DateTime

Obligatorio.Required. Valor Date para el que se desea determinar el día de la semana.A Date value for which you want to determine the day of the week.

DayOfWeek
FirstDayOfWeek FirstDayOfWeek FirstDayOfWeek

Opcional.Optional. Valor elegido de la enumeración FirstDayOfWeek que especifica el primer día de la semana.A value chosen from the FirstDayOfWeek enumeration that specifies the first day of the week. Si no se especifica, se utiliza Sunday.If not specified, Sunday is used.

Devoluciones

Valor Integer que contiene un número que representa el día de la semana.An integer value containing a number representing the day of the week.

Excepciones

DayOfWeek es menor que 0 o mayor que 7.DayOfWeek is less than 0 or more than 7.

Ejemplos

En el ejemplo siguiente se Weekday usa la función para obtener el día de la semana de una fecha especificada.The following example uses the Weekday function to obtain the day of the week from a specified date.

Dim oldDate As Date
Dim oldWeekDay As Integer
oldDate = #2/12/1969#
oldWeekDay = Weekday(oldDate)
' oldWeekDay now contains 4 because thisDate represents a Wednesday.

Comentarios

El valor devuelto por Weekday la función corresponde a los valores de FirstDayOfWeek la enumeración; es decir, 1 indica Domingo y 7 indica sábado.The value returned by the Weekday function corresponds to the values of the FirstDayOfWeek enumeration; that is, 1 indicates Sunday and 7 indicates Saturday.

Nota

Weekdayusa la configuración de calendario actual de CurrentCulture la propiedad de CultureInfo la clase en System.Globalization el espacio de nombres.Weekday uses the current calendar setting from the CurrentCulture property of the CultureInfo class in the System.Globalization namespace. Los valores CurrentCulture predeterminados se determinan mediante la configuración del Panel de control .The default CurrentCulture values are determined by Control Panel settings.

El DayOfWeek argumento puede tener una de las siguientes opciones.The DayOfWeek argument can have one of the following settings.

Valor de enumeraciónEnumeration value ValorValue DescripciónDescription
FirstDayOfWeek.System 00 Primer día de la semana especificado en la configuración del sistemaFirst day of week specified in system settings
FirstDayOfWeek.Sunday 11 Sunday (valor predeterminado)Sunday (default)
FirstDayOfWeek.Monday 22 Lunes (cumple con la norma ISO 8601, sección 3,17)Monday (complies with ISO standard 8601, section 3.17)
FirstDayOfWeek.Tuesday 33 MartesTuesday
FirstDayOfWeek.Wednesday 44 MiércolesWednesday
FirstDayOfWeek.Thursday 55 JuevesThursday
FirstDayOfWeek.Friday 66 ViernesFriday
FirstDayOfWeek.Saturday 77 SábadoSaturday

Se aplica a

Consulte también: