DayOfWeek Enum

Definition

{1>Especifica o dia da semana.<1}Specifies the day of the week.

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

Fields

Friday 5

Indica sexta-feira.Indicates Friday.

Monday 1

Indica segunda-feira.Indicates Monday.

Saturday 6

Indica sábado.Indicates Saturday.

Sunday 0

Indica domingo.Indicates Sunday.

Thursday 4

Indica quinta-feira.Indicates Thursday.

Tuesday 2

Indica terça-feira.Indicates Tuesday.

Wednesday 3

Indica quarta-feira.Indicates Wednesday.

Examples

O exemplo a seguir demonstra a propriedade DateTime.DayOfWeek e a enumeração DayOfWeek.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
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.
'

Remarks

A enumeração DayOfWeek representa o dia da semana em calendários que têm sete dias por semana.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. O valor das constantes nesta enumeração varia de domingo a sábado.The value of the constants in this enumeration ranges from Sunday to Saturday. Se for convertido em um inteiro, seu valor vai de zero (que indica domingo) para seis (que indica sábado).If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Essa enumeração é útil quando é desejável ter uma especificação fortemente tipada do dia da semana.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Por exemplo, essa enumeração é o tipo do valor da propriedade para as propriedades DateTime.DayOfWeek e DateTimeOffset.DayOfWeek.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek and DateTimeOffset.DayOfWeek properties.

Os membros da enumeração DayOfWeek não estão localizados.The members of the DayOfWeek enumeration are not localized. Para retornar o nome localizado do dia da semana, chame o DateTime.ToString(String) ou o método DateTime.ToString(String, IFormatProvider) com as cadeias de caracteres de formato "ddd" ou "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. A cadeia de caracteres de formato anterior produz o nome abreviado do dia da semana; o último produz o nome completo do dia da semana.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

Applies to