## Definición

Obtiene el día de la semana representado por esta instancia.

``````public:
property DayOfWeek DayOfWeek { DayOfWeek get(); };``````
``public DayOfWeek DayOfWeek { get; }``
``member this.DayOfWeek : DayOfWeek``
``Public ReadOnly Property DayOfWeek As DayOfWeek``

DayOfWeek

Constante enumerada que indica el día de la semana de este valor DateTime.

## Ejemplos

En el ejemplo siguiente se muestra la DayOfWeek propiedad y la System.DayOfWeek enumeración .

``````// This example demonstrates the DateTime.DayOfWeek property
using namespace System;
int main()
{

// Assume the current culture is en-US.
// Create a DateTime for the first of May, 2003.
DateTime dt = DateTime(2003,5,1);
Console::WriteLine(  "Is Thursday the day of the week for {0:d}?: {1}", dt, dt.DayOfWeek == DayOfWeek::Thursday );
Console::WriteLine(  "The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek );
}

/*
This example produces the following results:

Is Thursday the day of the week for 5/1/2003?: True
The day of the week for 5/1/2003 is Thursday.
*/
``````
``````// This example demonstrates the DateTime.DayOfWeek property
open System

// Assume the current culture is en-US.
// Create a DateTime for the first of May, 2003.
let dt = DateTime(2003, 5, 1)
printfn \$"Is Thursday the day of the week for {dt:d}?: {dt.DayOfWeek = DayOfWeek.Thursday}"
printfn \$"The day of the week for {dt:d} is {dt.DayOfWeek}."

// This example produces the following results:
//
// Is Thursday the day of the week for 5/1/2003?: True
// The day of the week for 5/1/2003 is Thursday.
``````
``````// This example demonstrates the DateTime.DayOfWeek property
using System;

class Sample
{
public static void Main()
{
// Assume the current culture is en-US.
// Create a DateTime for the first of May, 2003.
DateTime dt = new DateTime(2003, 5, 1);
Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}",
dt, dt.DayOfWeek == DayOfWeek.Thursday);
Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);
}
}
/*
This example produces the following results:

Is Thursday the day of the week for 5/1/2003?: True
The day of the week for 5/1/2003 is Thursday.
*/
``````
``````' This example demonstrates the DateTime.DayOfWeek property
Class Sample
Public Shared Sub Main()
' Assume the current culture is en-US.
' Create a DateTime for the first of May, 2003.
Dim dt As New DateTime(2003, 5, 1)
Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}", _
dt, dt.DayOfWeek = DayOfWeek.Thursday)
Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek)
End Sub
End Class
'
'This example produces the following results:
'
'Is Thursday the day of the week for 5/1/2003?: True
'The day of the week for 5/1/2003 is Thursday.
'
``````

## Comentarios

El valor de las constantes de la DayOfWeek enumeración va de DayOfWeek.Sunday a DayOfWeek.Saturday. Si se convierte en un entero, su valor va de cero (que indica DayOfWeek.Sunday) a seis (que indica DayOfWeek.Saturday).

La DayOfWeek propiedad devuelve una constante enumerada; no refleja la configuración regional y de idioma de un sistema. Para recuperar una cadena que representa un nombre de día de la semana localizado para una fecha determinada, llame a una de las sobrecargas del ToString método que incluye un `format` parámetro y pásela las `ddd` cadenas de formato personalizado o `dddd` . Para obtener más información, vea Cómo: Extraer el día de la semana a partir de una fecha específica.