如何在 vb.net 中为 datetimepicker 设置自定义格式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18945065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set custom format for datetimepicker in vb.net?
提问by user2765899
I just want to ask something, can I use a 12/10/93 date format in datetimepicker in VB.Net? mm/dd/yy specifically. If I can, how?
我只是想问一下,我可以在 VB.Net 的 datetimepicker 中使用 12/10/93 日期格式吗?特别是毫米/日/年。如果可以,怎么做?
回答by Neolisk
In the properties window for your DateTimePicker, set Format to Custom, then set CustomFormat to MM/dd/yy
, note the upper case MM
, lower case is reserved for minutes.
在 DateTimePicker 的属性窗口中,将 Format 设置为 Custom,然后将 CustomFormat 设置为MM/dd/yy
,注意大写MM
,小写保留为分钟。