I have asp.net Calendar to select the date ‘selectedDate’ and time Piker to select time ‘starttime ‘ I am trying to add the 2 strings 1 startTime object ‘startDateTime’
string strDate = Calendar1.SelectedDate.ToShortDateString(); ;
string startTime = txtb_endTimeManual.Text;
DateTime startDateTime = Convert.ToDateTime(strDate + startTime);
error message
String was not recognized as a valid DateTime.
You need to add a space between the two strings. If strDate is ‘1/15/2012’ and startTime is ‘6:30:00 PM’ then concatenating the two strings give you ‘1/15/20126:30:00 PM’ so the format is all off.