How to reset datetimepicker time in c #

I want to reset the time of selecting the date and time to 00:00 manually. When I select a date from it, I get the instance time, I select the time, is there any way I can reset it to provide the given time?

+4
source share
3 answers

How about this:

picker.Value = picker.Value.Date; 

EDIT: to indicate a specific time, you should use something like:

 TimeSpan time = new TimeSpan(3, 30, 0); // 3 hours and 30 minutes picker.Value = picker.Value.Date + time; 
+7
source

Reset time until 00:00:00

 dateTimePicker.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); 

Before reset:

 2009-08-15 20:27:42 

After reset

 2009-08-15 00:00:00 
+2
source

You can go to the constructor and set the Value value of the DateTimePicker control to 00:00 - it will disappear in the designer, but the value will be 00:00.

0
source

All Articles