DateTimePicker: pick both date and time

前端 未结 7 1556
独厮守ぢ
独厮守ぢ 2020-11-28 04:01

Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible

7条回答
  •  星月不相逢
    2020-11-28 04:26

    Set the Format to Custom and then specify the format:

    dateTimePicker1.Format = DateTimePickerFormat.Custom;
    dateTimePicker1.CustomFormat = "MM/dd/yyyy hh:mm:ss";  
    

    or however you want to lay it out. You could then type in directly the date/time. If you use MMM, you'll need to use the numeric value for the month for entry, unless you write some code yourself for that (e.g., 5 results in May)

    Don't know about the picker for date and time together. Sounds like a custom control to me.

提交回复
热议问题