Convert Date from "10/16/2019 00:00:00" to "Oct 16 2019 12:00 AM"

Hey Guys,
I am facing following problem:

I have a table column with dates in the format
“Oct 16 2019 12:00 AM” (A)
After processing it with the “for each row” activity, the format changes to
“10/16/2019 00:00:00” (B)

Is it possible to keep the format like A?

Or is there an easier way to change B back to A?

I can just think of complex solutions and would be glad to be taught an easier way

I have attached a file with Sample Dates
UiPath (8.3 KB)

If they are really DateTime then it is all the same, format is only a visual thing, if you are converting them to string at some point, then you can change to the format that you want, tho i do not recommend that you store dates as strings ever unless you dont have option…

The file ist processed further and therefore needs format A.

The data comes from excel? and then you write back to the same excel or another? are you using add data row?

Yes, they come from an Excel.
I process them with For-Each-Row.
And Create a new Excel with Write Range.

Then most likely is like i said in the first reply, the format is something in the excel file and it is only visual, you can format directly in your excel, because in the datatable it should be of type DateTime, but you can check this in debugger, if it is String, than you can adjust the format using row(“dateFieldName”).ToString(“MMM dd yyyy hh:mm”)


Have a play with
DateTime.ParseExact(“10/16/2019 00:00:00”, “MM/dd/yyyy hh:mm:ss”, CultureInfo.InvariantCulture).ToString(“MMM dd yyyy hh:mm tt”)

As already mentioned. alternate formating is only another representation of th same date

Use below Code to convert in B format:

Convert.ToDateTime("Oct 16 2019 12:00 AM").ToString("MM/dd/yyyy hh:mm:ss")

This will work for you and definitely resolve your issue.

Cheers @Wahid.N