1
votes

How to allow user to add hours,minutes and seconds in dateTimePicker object?

Currently, the datetimePicker only have day/month/year... want to add hours,minutes and seconds.

2
Change the Format property to "Time". If the want Date and Time then use "Custom" and change the CustomFormat property.Hans Passant
Ah, thanks Hans. To twice, i'm looking to change the input of the dateTimePicker, not the value...SGKawe

2 Answers

2
votes

Set the Format Property to "Custom" and the CustomFormat Property to include time

  dateTimePicker1.Format = DateTimePickerFormat.Custom;
  dateTimePicker1.CustomFormat = "dd-MMM-yy hh:mm:ss";
1
votes

You can format to Custom and then change the CustomFormat to dd-MMM-yyyy hh : mm : ss tt

datetimePicker.Format = DateTimePickerFormat.Custom;
datetimePicker.CustomFormat = "dd-MMM-yyyy hh : mm : ss tt"