Timespan set as (1, 2, 0, 0) is not midnight but 2 AM plus 1 day.
public TimeSpan( int days, int hours, int minutes, int seconds
You can confirm by setting the selected time to this value. It really gives 2AM (see code below and attachement).
Is there a solution to use StartTime and EndTime with an EndTime after midnight ?
- I can select it from the time picker,
- I can set it server side
- I can't write the value in the textbox
var startTime =
TimeSpan(9, 0, 0);
var endTime =
TimeSpan(1, 2, 0, 0);
TimePicker1.TimeView.StartTime = startTime;
TimePicker1.TimeView.EndTime = endTime.Add(
TimeSpan(0, 0, 1));
// Patch. Add 1 sec. to show the end time in the time view picker
TimePicker1.SelectedTime = endTime;
TimePicker1.MinDate = DateTime.Today.Add(startTime);
TimePicker1.MaxDate = DateTime.Today.Add(endTime);