DayOfWeek Énumération

Définition

Spécifie le jour de la semaine.Specifies the day of the week.

public enum class DayOfWeek
public enum DayOfWeek
[System.Serializable]
public enum DayOfWeek
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public enum DayOfWeek
type DayOfWeek = 
[<System.Serializable>]
type DayOfWeek = 
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type DayOfWeek = 
Public Enum DayOfWeek
Héritage
DayOfWeek
Attributs

Champs

Friday 5

Indique Friday (vendredi).Indicates Friday.

Monday 1

Indique Monday (lundi).Indicates Monday.

Saturday 6

Indique Saturday (samedi).Indicates Saturday.

Sunday 0

Indique Sunday (dimanche).Indicates Sunday.

Thursday 4

Indique Thursday (jeudi).Indicates Thursday.

Tuesday 2

Indique Tuesday (mardi).Indicates Tuesday.

Wednesday 3

Indique Wednesday (mercredi).Indicates Wednesday.

Exemples

L’exemple suivant illustre la DateTime.DayOfWeek propriété et l' DayOfWeek énumération.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.
'

Remarques

L' DayOfWeek énumération représente le jour de la semaine dans les calendriers qui ont sept jours par semaine.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. La valeur des constantes dans cette énumération est comprise entre dimanche et samedi.The value of the constants in this enumeration ranges from Sunday to Saturday. En cas de conversion en un entier, sa valeur est comprise entre zéro (ce qui indique Sunday) et six (qui indique Saturday).If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Cette énumération est utile quand il est souhaitable d’avoir une spécification fortement typée du jour de la semaine.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Par exemple, cette énumération est le type de la valeur de propriété pour les DateTime.DayOfWeek DateTimeOffset.DayOfWeek Propriétés et.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek and DateTimeOffset.DayOfWeek properties.

Les membres de l' DayOfWeek énumération ne sont pas localisés.The members of the DayOfWeek enumeration are not localized. Pour retourner le nom localisé du jour de la semaine, appelez la DateTime.ToString(String) DateTime.ToString(String, IFormatProvider) méthode ou avec les chaînes de format « 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. La première chaîne de format produit le nom abrégé du jour de la semaine ; ce dernier produit le nom complet du jour de la semaine.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

S’applique à