Changing the datatype of a datatable column


I have a datatable which I extract from a SAP table. I’ve created a simplified datatable which contains similar data to what I’m going to be working with:
The data is extracted from SAP as stringss

My question is this, how can I change the format of the ‘Start’ column to be datetime after the data has been extracted from SAP into the datatable? I’m needing to convert the whole column to DataTime as I’m going to need to perform some date calculations on data contained in the ‘Start’ Column.

I’ve tried using BalaReva’s EasyDataTable activity 'DateTime ParseTo DataTable, however it put data in the incorrect format (yyyy-MM-dd) and I must have data in the dd.MM.yyyy format.

Any help is appreciated!

Assuming the column changed to type DateTime yyyy-MM-dd is only representation of DateTime value, if you later want write the date in other format, use this row(“Start”).ToString(“dd.MM.yyyy”)

Thanks, I understand what you mean by thats the way that the datetime value is stored and that the format can be changed on output, however when I try this is the error I’m getting:

I’ve used the BalaReva activity to change the datatype of the column:


Replace row with CurrentRow.

Hi @Clintonnn

Try this condition in the Write Line activity


As @lakshman Suggested


HI @Clintonnn

Check on this link and try this activity


Hi @Clintonnn ,

Is this what you were looking for?


If you try to change the column type directly, there is a chance you might run into a collection modified error, which is why its best to create a separate DataTable and perform the conversion.

(From row In dt_sampleData.AsEnumerable()
Let dte = DateTime.ParseExact(row("Start").ToString.Trim,"dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture)
Let ra = New Object(){dte,row(1)}
Select dt_result.Rows.Add(ra)).CopyToDataTable()

ChangeColumnDataType.xaml (8.4 KB)

Kind Regards,
Ashwin A.K

1 Like

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