クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
.NET Framework 3.5
.NET Framework 3.5
System 名前空間
 DayOfWeek 列挙体
すべて縮小/すべて展開 すべて縮小
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2008/.NET Framework 3.5

その他のバージョンについては、以下の情報を参照してください。
.NET Framework クラス ライブラリ
DayOfWeek 列挙体

更新 : 2007 年 11 月

曜日を指定します。

名前空間 :  System
アセンブリ :  mscorlib (mscorlib.dll 内)
Visual Basic (宣言)
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration DayOfWeek
Visual Basic (使用法)
Dim instance As DayOfWeek
C#
[SerializableAttribute]
[ComVisibleAttribute(true)]
public enum DayOfWeek
Visual C++
[SerializableAttribute]
[ComVisibleAttribute(true)]
public enum class DayOfWeek
J#
/** @attribute SerializableAttribute */ 
/** @attribute ComVisibleAttribute(true) */
public enum DayOfWeek
JScript
public enum DayOfWeek
メンバ名説明
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifSunday 日曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifMonday 月曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifTuesday 火曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifWednesday 水曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifThursday 木曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifFriday 金曜日を示します。
zh6aacza.CFW(ja-jp,VS.90).gifzh6aacza.xna(ja-jp,VS.90).gifSaturday 土曜日を示します。

DayOfWeek 列挙型は、1 週間が 7 日ある予定表の曜日を表します。この列挙体の定数値の範囲は、DayOfWeek..::.Sunday から DayOfWeek..::.Saturday までです。整数にキャストする場合、値の範囲は 0 (DayOfWeek..::.Sunday) ~ 6 (DayOfWeek..::.Saturday) です。

この列挙型は、曜日を厳密に型指定する必要がある場合に役立ちます。たとえば、この列挙型は DateTime..::.DayOfWeek プロパティのプロパティ値の型です。

DayOfWeek 列挙体のメンバはローカライズされません。ローカライズされた曜日の名前を返すには、書式指定文字列 "ddd" または "dddd" で DateTime..::.ToString(String) メソッドまたは DateTime..::.ToString(String, IFormatProvider) メソッドを呼び出します。前の書式指定文字列では省略された曜日の名前が生成され、後の書式指定文字列では曜日の正式名が生成されます。

DateTime..::.DayOfWeek プロパティおよび DayOfWeek 列挙体の例を次に示します。

Visual Basic
' 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.
'
C#
// 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.
*/
Visual C++
// 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.
*/
J#
// This example demonstrates the DateTime.DayOfWeek property
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        // 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, (System.Boolean)(dt.get_DayOfWeek() == DayOfWeek.Thursday));
        Console.WriteLine("The day of the week for {0:d} is {1}.", dt, 
            dt.get_DayOfWeek());
    } //main
} //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.
*/

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

.NET Framework

サポート対象 : 3.5、3.0、2.0、1.1、1.0

.NET Compact Framework

サポート対象 : 3.5、2.0、1.0

XNA Framework

サポート対象 : 2.0、1.0
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件 | 商標 | プライバシー
Page view tracker