I want to reset the time of a date time picker to 00:00 manually. When i select the date from it i get the time of the instance i select the time is there any way i can reset it to given time?
How about this:
picker.Value = picker.Value.Date;
EDIT: To specify a particular time, you'd use something like:
TimeSpan time = new TimeSpan(3, 30, 0); // 3 hours and 30 minutes
picker.Value = picker.Value.Date + time;
Reset time to 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With