I have csv file which I read into a datatable. Now I would need to calculate days between two fields. The problem is that the values in the other column are in this format “17.12.2019 09:01:38”, when I open the csv in excel it shows that the format is “custom”. Any ideas how to convert this to datetime?
@MikkoL Can you show the Value of first row of Date Column using a Message Box after reading the csv file using a For Each Row?
Based on that format you can then use DateTime.ParseExact() to convert it into Date format and then Subtract it.
Use For Each Row of DT,
Inside For Each Row, Use an Assign Activity like below :
row(“days”) = (DateTime.Now-DateTime.ParseExact(row(“dateCol”).ToString,“dd.MM.yyyy HH:mm”,System.Globalization.CultureInfo.InvariantCulture)).Days.ToString
Write the Datatable to a Excel File using Write Range, The days Column Should be Updated .