Evaluar y enviar comentarios
MSDN
MSDN Library
System
 DayOfWeek (Enumeración)
Contraer todo/Expandir todo Contraer todo
Esta página es específica de
Microsoft Visual Studio 2005/.NET Framework 2.0

Hay además otras versiones disponibles para:
Biblioteca de clases de .NET Framework
DayOfWeek (Enumeración)

Indica el día de la semana.

Espacio de nombres: System
Ensamblado: mscorlib (en mscorlib.dll)

Visual Basic (Declaración)
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration DayOfWeek
Visual Basic (Uso)
Dim instance As DayOfWeek
C#
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum DayOfWeek
C++
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum class DayOfWeek
J#
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum DayOfWeek
JScript
SerializableAttribute 
ComVisibleAttribute(true) 
public enum DayOfWeek
 Nombre de miembroDescripción
Compatible con .NET Compact FrameworkFridayIndica viernes. 
Compatible con .NET Compact FrameworkMondayIndica lunes. 
Compatible con .NET Compact FrameworkSaturdayIndica sábado. 
Compatible con .NET Compact FrameworkSundayIndica domingo. 
Compatible con .NET Compact FrameworkThursdayIndica jueves. 
Compatible con .NET Compact FrameworkTuesdayIndica martes. 
Compatible con .NET Compact FrameworkWednesdayIndica miércoles. 

La enumeración DayOfWeek representa el día de la semana en los calendarios que tienen siete días por semana. Esta enumeración varía de cero, que indica domingo, a seis, que indica sábado.

Esta enumeración resulta útil cuando se desea tener una especificación con establecimiento inflexible de tipos del día de la semana. Por ejemplo, esta enumeración es el tipo del valor de la propiedad DateTime.DayOfWeek.

En el siguiente ejemplo se muestran la propiedad DateTime.DayOfWeek y la enumeración DayOfWeek.

Visual Basic
' 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.
'
C#
// 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.
*/
C++
// 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.
*/
J#
// This example demonstrates the DateTime.DayOfWeek property
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        // 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, (System.Boolean)(dt.get_DayOfWeek() == DayOfWeek.Thursday));
        Console.WriteLine("The day of the week for {0:d} is {1}.", dt, 
            dt.get_DayOfWeek());
    } //main
} //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.
*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter Edition

.NET Framework no admite todas las versiones de cada plataforma. Para obtener una lista de las versiones admitidas, vea Requisitos del sistema.

.NET Framework

Compatible con: 2.0, 1.1, 1.0

.NET Compact Framework

Compatible con: 2.0, 1.0
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker