DayOfWeek DayOfWeek DayOfWeek DayOfWeek Enum

Definición

Indica el día de la semana.Specifies the day of the week.

public enum class DayOfWeek
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum DayOfWeek
type DayOfWeek = 
Public Enum DayOfWeek
Herencia
Atributos

Campos

Friday Friday Friday Friday 5

Indica viernes.Indicates Friday.

Monday Monday Monday Monday 1

Indica lunes.Indicates Monday.

Saturday Saturday Saturday Saturday 6

Indica sábado.Indicates Saturday.

Sunday Sunday Sunday Sunday 0

Indica domingo.Indicates Sunday.

Thursday Thursday Thursday Thursday 4

Indica jueves.Indicates Thursday.

Tuesday Tuesday Tuesday Tuesday 2

Indica martes.Indicates Tuesday.

Wednesday Wednesday Wednesday Wednesday 3

Indica miércoles.Indicates Wednesday.

Ejemplos

En el ejemplo siguiente se muestra el DateTime.DayOfWeek propiedad y el DayOfWeek enumeración.The following example demonstrates the DateTime.DayOfWeek property and the DayOfWeek enumeration.

// 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
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
Imports System

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 'Main
End Class 'Sample
'
'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 DayOfWeek enumeración representa el día de la semana en los calendarios que tienen siete días por semana.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. El valor de las constantes de esta enumeración comprendido entre el domingo y el sábado.The value of the constants in this enumeration ranges from Sunday to Saturday. Si se convierte en un entero, su valor comprendido entre 0 (lo que indica el domingo) y 6 (lo que indica el sábado).If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Esta enumeración es útil cuando resulta conveniente tener una especificación fuertemente tipada del día de la semana.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Por ejemplo, esta enumeración es el tipo del valor de propiedad para el DateTime.DayOfWeek propiedad.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek property.

Los miembros de la DayOfWeek enumeración no están localizados.The members of the DayOfWeek enumeration are not localized. Para devolver el nombre localizado del día de la semana, llame a la DateTime.ToString(String) o DateTime.ToString(String, IFormatProvider) método con las cadenas de formato "ddd" o "dddd".To return the localized name of the day of the week, call the DateTime.ToString(String) or the DateTime.ToString(String, IFormatProvider) method with either the "ddd" or "dddd" format strings. La primera cadena de formato genera el nombre del día laborable abreviado; Esto último genera el nombre del día laborable completo.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

Se aplica a