2
Answers

cannot implicitly convert type System.Date.Time to System.timespan

Ramco Ramco

Ramco Ramco

2y
2.5k
1

Hi

  How to save this in time fields. In dropdowni have value 08:40

DateTime StartTime = DateTime.Now;
                    String Time = ddlTimeFrom.SelectedItem.Value ;
                    String DT1 = txtdtFrom.Text + " " + Time;
                    DateTime StartDate = DateTime.ParseExact(DT1, "dd-MM-yyyy HH:mm", System.Globalization.CultureInfo.InvariantCulture);
                     StartTime = Convert.ToDateTime(StartDate.ToString("yyyy-MM-dd HH:mm"));

Thanks

Answers (2)