Hi
I am trying to upload data but it is giving above error
DateTime StartTime = DateTime.Now;String Time = colum[2].ToString();String DT1 = colum[1].ToString() + " " + 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"));
Below is the Excel Data
| col1 | Col2 | Col3 |
| 13 | 01/04/2022 | 14:30 |
| 18 | 02/04/2022 | 16:00 |
| 13 | 03/04/2022 | 17:15 |
Thanks
Jagjit SainiPosted Mar 27, 2022, 12:02 PM
Hi Muhammda
I am inporting Data frim Excel
I cannot write - String Time = "14:30";
Currently it is showing as 31/12/1899 14:30 . It should show only 14:30
Thanks
Muhammad Imran AnsariPosted Mar 27, 2022, 11:55 AM
Jagjit SainiPosted Mar 27, 2022, 11:27 AM
Sachin SinghPosted Mar 27, 2022, 11:07 AM
Jagjit SainiPosted Mar 27, 2022, 10:54 AM
Hi
Error is coming on StartDate i think so
Error - Cannot implicitly convert type string to string.date.time
StartTime = Convert.ToDateTime(StartDate).ToString("yyyy-MM-dd HH:mm");
Thanks
Sachin SinghPosted Mar 27, 2022, 10:44 AM