-1

I want a time picker in visual studio, I did find a DateTimePicker but turns out it's just a date picker enter image description here

I did something similiar in Qt, I found a time picker there, I need soemthing like this in VS:

enter image description here

user5820174
  • 151
  • 1
  • 12

1 Answers1

1

You can use 2 datetimepickers to pick date AND time. They can pick Date OR time in WinForms (But not both) Put a first one with the name of datePortionDateTimePicker Put a second one and name it timePortionDateTimePicker. Then on the form load apply these settings:

timePortionDateTimePicker.Format = DateTimePickerFormat.Time;
timePortionDateTimePicker.ShowUpDown = true;

When you need to combine date AND time use :

DateTime myDate = datePortionDateTimePicker.Value.Date + timePortionDateTimePicker.Value.TimeOfDay;

More info :

DateTimePicker: pick both date and time

Community
  • 1
  • 1
Jurion
  • 1,230
  • 11
  • 18