DayOfWeek DayOfWeek DayOfWeek DayOfWeek Enum

Definice

Určuje den v týdnu.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
Dědičnost
Atributy

Pole

Friday Friday Friday Friday 5

Označuje pátek.Indicates Friday.

Monday Monday Monday Monday 1

Indikuje pondělí.Indicates Monday.

Saturday Saturday Saturday Saturday 6

Označuje sobotu.Indicates Saturday.

Sunday Sunday Sunday Sunday 0

Označuje neděli.Indicates Sunday.

Thursday Thursday Thursday Thursday 4

Indikuje čtvrtek.Indicates Thursday.

Tuesday Tuesday Tuesday Tuesday 2

Indikuje úterý.Indicates Tuesday.

Wednesday Wednesday Wednesday Wednesday 3

Označuje středu.Indicates Wednesday.

Příklady

Následující příklad ukazuje DateTime.DayOfWeek vlastnost DayOfWeek a výčet.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.
'

Poznámky

DayOfWeek Výčet představuje den v týdnu v kalendářích, které mají sedm dní týdně.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. Hodnota konstant v tomto výčtovém rozsahu je od neděle do sobotu.The value of the constants in this enumeration ranges from Sunday to Saturday. Při přetypování na celé číslo má jeho rozsah hodnotu od nuly (což označuje neděli) na šest (což označuje sobotu).If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Tento výčet je užitečný v případě, že je žádoucí, aby se specifikace silného typu nastavila dne v týdnu.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Například tento výčet je typ hodnoty vlastnosti pro DateTime.DayOfWeek vlastnost.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek property.

Členy DayOfWeek výčtu nejsou lokalizovány.The members of the DayOfWeek enumeration are not localized. Chcete-li vrátit lokalizovaný název dne v týdnu, zavolejte DateTime.ToString(String) DateTime.ToString(String, IFormatProvider) metodu nebo pomocí formátovacích řetězců "ddd" nebo "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. Dřívější řetězec formátu vytvoří zkrácený název dne v týdnu. druhý vytvoří úplný název dne v týdnu.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

Platí pro