DateTimePickerFormatとは? わかりやすく解説

DateTimePicker.Format プロパティ

コントロール表示される日時書式取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Property Format As
 DateTimePickerFormat
Dim instance As DateTimePicker
Dim value As DateTimePickerFormat

value = instance.Format

instance.Format = value
public DateTimePickerFormat Format { get; set;
 }
public:
property DateTimePickerFormat Format {
    DateTimePickerFormat get ();
    void set (DateTimePickerFormat value);
}
/** @property */
public DateTimePickerFormat get_Format ()

/** @property */
public void set_Format (DateTimePickerFormat
 value)
public function get Format
 () : DateTimePickerFormat

public function set Format
 (value : DateTimePickerFormat)

プロパティ
DateTimePickerFormat 値の 1 つ既定値Long です。

例外例外
例外種類条件

InvalidEnumArgumentException

代入された値が、DateTimePickerFormat 値ではありません。

解説解説

このプロパティは、日付表示するときに適用する日時書式決定します日時書式は、オペレーティング システム上のカルチャに基づいて決定されます。

メモメモ

表示される日時書式を CustomFormat プロパティ指定できるようにするには、Format プロパティを DateTimePickerFormat.Custom に設定する必要があります

時刻だけを DateTimePicker に表示するには、FormatTime設定し、ShowUpDown プロパティfalse設定します

使用例使用例

DateTimePicker日付が "June 01, 2001 - Friday" と表示されるように、CustomFormat プロパティ設定するコード例次に示します。このコードは、DateTimePicker コントロールインスタンスForm 上に作成されていることを前提にしています。

Public Sub SetMyCustomFormat()
    ' Set the Format type and the CustomFormat string.
    dateTimePicker1.Format = DateTimePickerFormat.Custom
    dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd"
End Sub 'SetMyCustomFormat
public void SetMyCustomFormat()
{
   // Set the Format type and the CustomFormat string.
   dateTimePicker1.Format = DateTimePickerFormat.Custom;
   dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
}

public:
   void SetMyCustomFormat()
   {
      // Set the Format type and the CustomFormat string.
      dateTimePicker1->Format = DateTimePickerFormat::Custom;
      dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd";
   }
public void SetMyCustomFormat()
{
    // Set the Format type and the CustomFormat string.
    dateTimePicker1.set_Format(DateTimePickerFormat.Custom);
    dateTimePicker1.set_CustomFormat("MMMM dd, yyyy - dddd");
} //SetMyCustomFormat
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DateTimePicker クラス
DateTimePicker メンバ
System.Windows.Forms 名前空間
DateTimePickerFormat

DateTimePickerFormat 列挙体

DateTimePicker コントロール表示する日時書式指定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Enumeration DateTimePickerFormat
Dim instance As DateTimePickerFormat
public enum DateTimePickerFormat
public enum class DateTimePickerFormat
public enum DateTimePickerFormat
public enum DateTimePickerFormat
メンバメンバ
解説解説
使用例使用例

FormatDateTimePickerFormat 値に設定して DateTimePicker オブジェクト初期化するコード例次に示します。この例を実行するには、次のコードフォーム貼り付けてフォームコンストラクタまたは Load イベント処理メソッドInitializeDateTimePicker呼び出します。

' Declare the DateTimePicker.
Friend WithEvents DateTimePicker1 As
 System.Windows.Forms.DateTimePicker


Private Sub InitializeDateTimePicker()

    ' Construct the DateTimePicker.
    Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker

    'Set size and location.
    Me.DateTimePicker1.Location = New System.Drawing.Point(40,
 88)
    Me.DateTimePicker1.Size = New Size(160,
 21)
    
    ' Set the alignment of the drop-down MonthCalendar to right.
    Me.DateTimePicker1.DropDownAlign = LeftRightAlignment.Right

    ' Set the Value property to 50 years before today.
    DateTimePicker1.Value = (DateTime.Now.AddYears(-50))

    'Set a custom format containing the string "of the year"
    DateTimePicker1.Format = DateTimePickerFormat.Custom
    DateTimePicker1.CustomFormat = "MMM dd, 'of the year' yyyy
 "

    ' Add the DateTimePicker to the form.
    Me.Controls.Add(Me.DateTimePicker1)
End Sub
// Declare the DateTimePicker.
internal System.Windows.Forms.DateTimePicker DateTimePicker1;


private void InitializeDateTimePicker()
{
    // Construct the DateTimePicker.
    this.DateTimePicker1 = new System.Windows.Forms.DateTimePicker();

    //Set size and location.
    this.DateTimePicker1.Location = new System.Drawing.Point(40,
 88);
    this.DateTimePicker1.Size = new System.Drawing.Size(160,
 21);
    
    // Set the alignment of the drop-down MonthCalendar to right.
    this.DateTimePicker1.DropDownAlign = LeftRightAlignment.Right;

    // Set the Value property to 50 years before today.
    DateTimePicker1.Value = System.DateTime.Now.AddYears(-50);

    //Set a custom format containing the string "of the year"
    DateTimePicker1.Format = DateTimePickerFormat.Custom;
    DateTimePicker1.CustomFormat = "MMM dd, 'of the year' yyyy ";

    // Add the DateTimePicker to the form.
    this.Controls.Add(this.DateTimePicker1);
}
internal:
   // Declare the DateTimePicker.
   System::Windows::Forms::DateTimePicker^ DateTimePicker1;

private:
   void InitializeDateTimePicker()
   {
      // Construct the DateTimePicker.
      this->DateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker;
      
      //Set size and location.
      this->DateTimePicker1->Location = System::Drawing::Point(
 40, 88 );
      this->DateTimePicker1->Size = System::Drawing::Size(
 160, 21 );
      
      // Set the alignment of the drop-down MonthCalendar to right.
      this->DateTimePicker1->DropDownAlign = LeftRightAlignment::Right;
      
      // Set the Value property to 50 years before today.
      DateTimePicker1->Value = System::DateTime::Now.AddYears(  -50 );
      
      //Set a custom format containing the string "of the year"
      DateTimePicker1->Format = DateTimePickerFormat::Custom;
      DateTimePicker1->CustomFormat = "MMM dd, 'of the year' yyyy ";
      
      // Add the DateTimePicker to the form.
      this->Controls->Add( this->DateTimePicker1
 );
   }
// Declare the DateTimePicker.
private System.Windows.Forms.DateTimePicker dateTimePicker1;

private void InitializeDateTimePicker()
{
    // Construct the DateTimePicker.
    this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
    //Set size and location.
    this.dateTimePicker1.set_Location(new System.Drawing.Point(40,
 88));
    this.dateTimePicker1.set_Size(new System.Drawing.Size(160,
 21));
    // Set the alignment of the drop-down MonthCalendar to right.
    this.dateTimePicker1.set_DropDownAlign(LeftRightAlignment.Right);
    // Set the Value property to 50 years before today.
    dateTimePicker1.set_Value(System.DateTime.get_Now().AddYears(-50));
    //Set a custom format containing the string "of the year"
    dateTimePicker1.set_Format(DateTimePickerFormat.Custom);
    dateTimePicker1.set_CustomFormat("MMM dd, 'of the year' yyyy ");
    // Add the DateTimePicker to the form.
    this.get_Controls().Add(this.dateTimePicker1);
} //InitializeDateTimePicker
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からDateTimePickerFormatを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDateTimePickerFormatを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDateTimePickerFormat を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DateTimePickerFormat」の関連用語

DateTimePickerFormatのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DateTimePickerFormatのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS