Changing format from "dd/M/yyyy" to "dd/MM/yyyy" in Excel

Hi,

I have .xlsx file in one of columns are dates in format “dd/M/yyyy” for example “24.9.2022”. I would like to change it on: 24.09.2022 to have “dd/MM/yyyy” format.
How to do it?

Thank you for your help :slight_smile:

@PLICHTA_Aleksandra
Please try this one in assign activity
DateTime.ParseExact(yourdatevariable.toString(), “dd/M/yyyy”, Globalization.CultureInfo.InvariantCulture)
.ToString(“dd/MM/yyyy”)

Hello @PLICHTA_Aleksandra ,

You could use the Format Range activity. Source: https://docs.uipath.com/studiox/v2019/docs/format-range-x

image

Hope it helps!
Best regards,
Marius

1 Like

Hi,

In my case I would like to change whole CurrentRow(5), where should I put this infomation?

One more question:
What type of argument/ variable should I chose?
In String there is an error

@PLICHTA_Aleksandra wait I am giving you sample code.

1 Like

System.Datetime.ParseExact(CurrentRow(“Date”).ToString,“dd.M.yyyy”,New system.Globalization.CultureInfo(“en-US”)).ToString(“dd.MM.yyyy”).ToString
This one is correct with your format.
ReadExcelFileAndChangeDateFormat.xaml (6.9 KB)
test.xlsx (8.4 KB)

@PLICHTA_Aleksandra please test, if you get your solution please mark it as a solution

Hello @PLICHTA_Aleksandra

You can use Modify Date activity.

How to Modify Date in UiPath? Modify Date activity explained with demo

Thanks

HI @PLICHTA_Aleksandra

Can you Print the excel data in the Log message and share the format here or share the sample excel file?

You can try with CDate

CDate("24.9.2022").Tostring("dd/MM/yyyy")

If you use For each row in DataTable activity Try like this

CDate(Currentrow("Column Name").Tostring).Tostring("dd/MM/yyyy")

Regards
Gokul