繁体   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