创建2个DateTimePicker,分别为datetimepicker1和datetimepicker2,1用来显示日期,2用来显示时间。
代码如下:
////日期
datetimepicker1.Format = DateTimePickerFormat.Custom;
datetimepicker1.CustomFormat = "yyyy:MM:dd";
////时间
datetimepicker2.Format = DateTimePickerFormat.Time;
datetimepicker2.CustomFormat = "HH:mm:ss";
datetimepicker2.ShowUpDown = true;
1