DateTimePicker.CustomFormat プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As DateTimePicker Dim value As String value = instance.CustomFormat instance.CustomFormat = value
[LocalizableAttribute(true)] public: property String^ CustomFormat { String^ get (); void set (String^ value); }
/** @property */ public String get_CustomFormat () /** @property */ public void set_CustomFormat (String value)
カスタムの日付/時刻書式を表す文字列。既定値は null 参照 (Visual Basic では Nothing) です。

日付と時刻の区切り記号や書式指定文字列を含むリテラル文字列を表示するには、部分文字列に対してエスケープ文字を使用する必要があります。たとえば、日付を "June 15 at 12:00 PM" と表示するには、CustomFormat プロパティを "MMMM dd 'at' t:mm tt" に設定します。部分文字列 "at" をエスケープ文字で囲まなかった場合は、"June 15 aP 12:00PM" と表示されます。これは、文字 "t" が 1 文字の A.M./P.M. の書式指定文字列として解釈されたためです (次の書式指定文字列の表を参照)。
書式指定文字列を組み合わせて、日付と時刻の書式を指定できます。たとえば、日付と時刻を 06/15/2001 12:00 PM と表示するには、このプロパティを "MM'/'dd'/'yyyy hh':'mm tt" に設定する必要があります。詳細については、「日付と時刻の書式指定文字列」を参照してください。
![]() |
---|
表示される日時の書式をこのプロパティで指定できるようにするには、Format プロパティを DateTimePickerFormat.Custom に設定する必要があります。 |

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"; }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDateTimePicker.CustomFormat プロパティを検索する場合は、下記のリンクをクリックしてください。

- DateTimePicker.CustomFormat プロパティのページへのリンク