Date format in DataTable

Hi there.

I have a small problem. I read a CSV file and keep it in a DataTable:
readCSV

Then I paste this Data Table using Excel activity
writeCSV

The problem is that my DataTable is giving me the RIGHT output format:
good

And in my Excel file, the format is not good…
bad

How can I keep the correct date format? Knowing that I want in French format DD/MM/YYYY?

Thanks

Hi @DimitriLYR

How about this expression

DateTime.ParseExact(YourString,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Regards
Gokul

Check out the Video link to change the format in the excel @DimitriLYR

You can try with Studio X activity

https://docs.uipath.com/activities/docs/format-range-x

Regards
Gokul

Hello @DimitriLYR
Try this

DateTime.ParseExact(YourString,"MM/dd/yyyy HH:mm:ss",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

or

DateTime.ParseExact(YourString,"MM/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")

Thank you so much. Very nice !

Where you need to put this expression as he said he is directly copy from datatable to excel ?

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