DayOfWeek 열거형

정의

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

적용 대상