Is it possible to set the timepicker value in code.
What I am thinking here is that if I have a timepicker and choose a time value, thats the time is should use.
But if I dont choose a time value, it should set 00:00 as default and I want to do this with code.
Hade some crazy idea that looked like this:
DateTime date;
date.Hour(00:00:00)
Didnt work that good so is there any good way for making this.
UPDATE
Here is what i am thinking:
DateTime? temp = (DateTime)startDate.Value;
DateTime date1;
if (temp == null)
{
//Set the time to 00:00
}
else
{
date1 = (DateTime)temp;
}
update2 Here is all code and getting an exception and thats why i want to set the value in code becasue accepting nullable datetime didnt seem to work.
DateTime date = (DateTime)datePicker.Value;
DateTime break1S = (DateTime)startBreak1.Value;
_nestedDateStartBreak1 = new DateTime(date.Year, date.Month, date.Day, break1S.Hour, break1S.Minute, 0);