簡體   English   中英

C#DateTimePicker自定義格式

[英]C# DateTimePicker Custom Format

如何將DateTimePicker設置為輸出dd / mm / yyyy。

現在它給了我一天,一天,一個月然后一年。

謝謝。

dateTimePicker1.CustomFormat = "dd/MM/yyyy";
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "dd/MM/yyyy";
dateTimePicker1.Format = DateTimePickerFormat.Custom;

您需要將屬性DateTimePicker.Format設置為DateTimePickerFormat.Custom並在DateTimePicker.CustomFormat屬性中設置所需的格式。

        // Set the Format type and the CustomFormat string.
        dtpDeliveryDate.Format = DateTimePickerFormat.Custom;
        dtpDeliveryDate.CustomFormat = "dd-MM-yyyy";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM