Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 523.3k

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

Aug 28 2022 8:14 AM

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)