Excel date format changes itself

hey guys, i’m trying to read an excel file, and sort it base on dates, take top 20 and write the output to a new excel file
the original file has date format like this
image
but the output becomes like this
image
some rows have their date format changed

this would be a problem for me because i need to append and sort the file regularly, since the date format has changed i can’t sort it base on the dates.
any solution ?

Hey @RobertoEwaldo

Just you have to convert them in a same format and then you will be able to sort :slight_smile:
just check with your possible formats and convert them to standard one which suits you :slight_smile:

That will be easy to go for you.

Regards…!!
Aksh

3 Likes

Try this How to sort a data table based on a column which is a date:

hi @aksh1yadav
how can i convert the date format in that column from uipath ? later the program will run daily with scheduler so i can’t change it manually from excel

already tried that buddy, the sort works well, but the problem is the date format changes itself
i’m using
(From row In dtFilter Order By DateTime.ParseExact(row.Item(“Database date”).ToString, “dd MMMM yyyy H:mm:ss”, new System.Globalization.CultureInfo(“id-ID”)) Ascending Select row).CopyToDataTable

Here. this might help

DateTime yourDateVar = DateTime.FromOADate(43007) For result: yourDateVar .ToString(“MM-dd-yyyy”)

@RobertoEwaldo
Hey! I’m facing the same issue. If the cell value is in dd/MM/yy format, after write cell into another excel the format changes to MM/dd/yy. Any idea how to resolve this?
@UiPathMaster