The robot is entering the wrong date format

Hey!

My robot is entering the wrong date format. The robot should copy the date from excel in the format dd.mm.yyyy - this is how it is entered in excel, but the robot uses the format: mm/dd/yyy. How can I change date format?

Thank You.

Hi @sullivanne
Use this syntax:

DateTime.ParseExact(CurrentRow("Date").ToString,"dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Store this in a string variable.

Hope it helps!!

Hi @sullivanne

How about this expression?

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

Regards
Gokul

Check out this link @sullivanne

https://forum.uipath.com/search?q=change%20date%20format%20%40Gokul001

Regards
Gokul


Thank You. Unfortunately, I don’t know where to add it. I’m working on StudioX.

@sullivanne
are you adding the date on type into activity?

Regards,

Yes,
image
Robot copies the date from the column in Excel

@sullivanne

Use this syntax:

DateTime.ParseExact(CurrentRow("DATA_DoK").ToString,"dd.MM.yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")
1 Like

Ok, I added it to the activity type into, but I have error.

@sullivanne

what is your date format in excel. If possible share the sample excel.

Regards,

example.xlsx (19.7 KB)
Thank you, this is example with this column.

The date format is wrong, try

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

Using the logic provided by @Parvathy

1 Like

I will let you know in a short while @sullivanne

Regards,

1 Like

Hi @sullivanne

Use this syntax:

DateTime.ParseExact(CurrentRow("DATA_DOK").toString,"M/dd/yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

this syntax will take the date format in the form M/dd/yyyy and will convert to the format dd.MM.yyyy.
If you want any other format please specify there at last.

I have shared a sample code too please check.
NewBlankTask2.zip (328.7 KB)

Hope it helps!
Regards,

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