Hi all,
I have a excel with columns as below
Name Date Account
XYZ. 20/6/2022. 432
FGH. 20/6/2022. 123
ABC. 13-02-2023. 656
ASD. 13-02-2023. 546
So in Date column I want to keep the date as dd-MM-yyyy.
I am ready the excel, I am passing that dt_exceloutput to for each row, inside the foreach I have taken an assign
format date = Date time.ParseExtract(row(“Date”).To string.Substring(0,10),“dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”)
This is working fine until first 2 rows from 3rd row I am getting error as string was not recognised as a valid Date time.
format date = Date time.ParseExtract(row(“Date”).To string.Substring(0,10),{“dd/MM/yyyy”,“dd-MM-yyyy”},System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”)
you can add how many you want like using {“dd/MM/yyyy”,“dd-MM-yyyy”}
format date = Date time.ParseExtract(row(“Date”).To string.Substring(0,10),{“dd/MM/yyyy”,"dd-MM-yyyy"}, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd-MM-yyyy”)