Hi,
I have an column in which multiple date format has present.
so I want to convert all format into specific format i.e. MM/dd/yyyy
Sample Data:
20/02/24
02/30/2024
13-08-2024
13/08/2024 so on…
Hi,
I have an column in which multiple date format has present.
so I want to convert all format into specific format i.e. MM/dd/yyyy
Sample Data:
20/02/24
02/30/2024
13-08-2024
13/08/2024 so on…
Hi @itbuddy1
Use the below code in Invoke Code:
dt.AsEnumerable().ToList().ForEach(Sub(row) row("DateColumn") = DateTime.ParseExact(row("DateColumn").ToString().Trim(), {"dd/MM/yy", "dd/MM/yyyy", "MM/dd/yyyy", "dd-MM-yyyy"}, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy"))
Pass dt as In/Out as DataTable.
Hope it helps!!
check this thread as reference
hi, thanks for the solution but this will convert only some data.
for your reference I am provide more sample data.
can u provide me the solution accordingly
28-09-2024
12-09-2024
23-09-2024
26-09-2024
26-09-2024
25-09-2024
11-09-2024
26-09-2024
25-09-2024
02-09-2024
27-09-2024
10-09-2024
26-09-2024
27-09-2024
01-09-2024
27-09-2024
07-09-2024
27-09-2024
28-09-2024
28-09-2024
28-09-2024
28-09-2024
I already share the data in above chat these are in date format in an excel
Plz help me because this process is running in production
Hi,
I tried above solution that is work but only work in which cell is in date type not in custom type
actually in this file some date type is date or some is custom type.
I have attached the actual data which I have received from user
Sample.xlsx (9.3 KB)
Hi,
I am not able to open this XAML. This is showing invalid document.
dt.AsEnumerable().ToList().ForEach(Sub(row) row("Proposed End Date") = DateTime.ParseExact(row("Proposed End Date").ToString().Trim(), {"M/dd/yyyy", "dd-MM-yyyy"}, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None).ToString("MM/dd/yyyy"))
Note: Enable Preserve Format Option in Read Range Workbook activity
Regards,