How to access each item dynamicaaly in Datatable

Hello All,
I have a datatable scraped from a website:-
Type India Uk Germany
ES 22SEP16 22SEP16 C
ET U 01JAN19 01JAN19
EG C 01FEB20 U

My requirement is to replace the date column wherever present as yyyy-MM-dd format.
Type India Uk Germany
ES 2016-09-22 2016-09-22 C
ET U 2019-01-01 2019-01-01
EG C 2020-02-20 U
Pls, let me know how to loop through each datarow and change the value dynamically,

can be done similar to:

we can use Regex.IsMatch and dateTime.ParseExact for the adoption
another option would be a flow with nested loops

  • for each row
    • for each | item | Values: row.ItemArray | TypeArgument: Object

Thanks…I checked this solution.I am not good at linq.
Could you pls help me to resolve the error
(From r In dt_Master.AsEnumerable
Let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.Replace(“C”,“FF”)).toArray()
Select dtCorrected.Rows.Add(ra)).CopyToDataTable()

Error getting -dtcorrected either not declared or not in current scope

sample input/output

Find starter help here:
Replace_AllDateFormats.xaml (10.6 KB)

1 Like


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.