DayOfWeek 열거형

정의

요일을 지정합니다.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
상속
DayOfWeek
특성

필드

Friday 5

금요일을 나타냅니다.Indicates Friday.

Monday 1

월요일을 나타냅니다.Indicates Monday.

Saturday 6

토요일을 나타냅니다.Indicates Saturday.

Sunday 0

일요일을 나타냅니다.Indicates Sunday.

Thursday 4

목요일을 나타냅니다.Indicates Thursday.

Tuesday 2

화요일을 나타냅니다.Indicates Tuesday.

Wednesday 3

수요일을 나타냅니다.Indicates Wednesday.

예제

다음 예제에서는 DateTime.DayOfWeek 속성 및 열거형을 보여 줍니다 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.
'

설명

DayOfWeek열거형은 일주일에 7 일이 포함 된 달력의 요일을 나타냅니다.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. 이 열거형의 상수 값은 일요일부터 토요일 까지의 범위에 있습니다.The value of the constants in this enumeration ranges from Sunday to Saturday. 정수로 캐스팅 하는 경우 해당 값의 범위는 0 (일요일을 나타냄)에서 6 (토요일을 나타냄) 사이입니다.If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

이 열거형은 요일의 강력한 형식의 사양을 갖는 것이 바람직 할 때 유용 합니다.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. 예를 들어이 열거형은 및 속성에 대 한 속성 값의 형식입니다 DateTime.DayOfWeek DateTimeOffset.DayOfWeek .For example, this enumeration is the type of the property value for the DateTime.DayOfWeek and DateTimeOffset.DayOfWeek properties.

열거형의 멤버는 DayOfWeek 지역화 되지 않습니다.The members of the DayOfWeek enumeration are not localized. 요일에 대 한 지역화 된 이름을 반환 하려면 DateTime.ToString(String) DateTime.ToString(String, IFormatProvider) "ddd" 또는 "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. 이전 형식 문자열은 축약 된 요일 이름을 생성 합니다. 후자는 전체 요일 이름을 생성 합니다.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

적용 대상