Date Format Issue

Hi There,

I have a string variable for date with the default set to Datetime.Now.toString(“dd/MM/yyyy”)

My issue is that on the output the date format is showing as “MM/dd/yyyy” rather than the defined “dd/MM/yyyy”

I believe VB uses the American format as default however I would have thought having the variable defined would have overwritten this?

Any thoughts as to why this might be?

Thanks in advance,
Cam

Hi @gradycb

I have faced this same scenario. Though you change the format to “dd/MM/yyyy” in UiPath Studio, once you place the data in the excel sheet, irrespective of the format we had in Studio variables, it gets changed to the excel specified format of the date in excel. So what you can do is, Have the excel sheet column data format in the same “dd/MM/yyyy” format. It will actually display the correct format once the data is in the excel sheet.

For some additional info, irrespective of the format that excel shows the date in its cell, once we get the data to a variable in Studio, it has the format we defines in the variable.

Hope it helps!!

Hi @Lahiru.Fernando

Thanks for responding so quickly, I was having a think about it last night & thought it might have been something like this!

So are you saying the only solution is to manually format the sheet externally to UIPath or is there a parameter/property or method in UIPath itself that can force an override in Excel? Reason I ask is that I wont always have access to the output files to manually format before being consumed by the systems I work with. In cases like this would CSV be a more appropriate solution?

Many Thanks
Cam

Hi @gradycb

Yeah. As far as i know, We have several options here. Either we can do it manually. But i dont think its a nice way to deal with it when it comes to RPA. However, we can automate the date format conversion in excel using uipath itself.

How to do it is to open the excel file using excel application scope, and have some activities within it to perform the same clicks that we do in excel to change the date format. So its basically automating within excel to click on those menus… this can be done easily if you have access to open the file.

Or else, we can use the CSV format instead of xlsx format as you said.