DayOfWeek DayOfWeek DayOfWeek DayOfWeek Enum

Definition

Gibt den Wochentag an.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
Vererbung
Attribute

Felder

Friday Friday Friday Friday 5

Gibt Freitag an.Indicates Friday.

Monday Monday Monday Monday 1

Gibt Montag an.Indicates Monday.

Saturday Saturday Saturday Saturday 6

Gibt Sonnabend an.Indicates Saturday.

Sunday Sunday Sunday Sunday 0

Gibt Sonntag an.Indicates Sunday.

Thursday Thursday Thursday Thursday 4

Gibt Donnerstag an.Indicates Thursday.

Tuesday Tuesday Tuesday Tuesday 2

Gibt Dienstag an.Indicates Tuesday.

Wednesday Wednesday Wednesday Wednesday 3

Gibt Mittwoch an.Indicates Wednesday.

Beispiele

Das folgende Beispiel zeigt die DateTime.DayOfWeek Eigenschaft und die DayOfWeek Enumeration.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.
'

Hinweise

Die DayOfWeek Enumeration darstellt, der den Wochentag im Kalender mit sieben Tage pro Woche.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. Der Wert der Konstanten in dieser Enumeration reicht von Sonntag bis Samstag.The value of the constants in this enumeration ranges from Sunday to Saturday. Bei der Umwandlung in eine ganze Zahl, der Wert von 0 (womit Sonntag) bis 6 (womit Samstag).If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Diese Enumeration ist nützlich, wenn es wünschenswert ist, das Spezifikation ein stark typisiertes des Tages der Woche haben.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Diese Enumeration ist beispielsweise der Typ des Eigenschaftswerts für die DateTime.DayOfWeek Eigenschaft.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek property.

Die Mitglieder der DayOfWeek Enumeration sind nicht lokalisiert.The members of the DayOfWeek enumeration are not localized. Rufen Sie zum Zurückgeben der lokalisierte Name des Tags der Woche der DateTime.ToString(String) oder DateTime.ToString(String, IFormatProvider) -Methode mit der "Ddd" oder "Dddd" Formatzeichenfolgen.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. Die erste Zeichenfolge erzeugt den abgekürzten Wochentagsnamen; den vollen Wochentagsnamen erstellt.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

Gilt für: