Changing variable date format

Hello
I am get a variable of date like this e.g : 21.02.23
And I want to convert it to : 21/02/23
How can I do that please ?

Thanks.

@mironb,

Try this,

DateTime.ParseExact("21.02.23", "dd.MM.yy", System.Globalization.CultureInfo.InvariantCulture).Tostring("dd/MM/yy")

The 21.02.23 is a Dynamic variable - its not consist date.
How to implement ?

HI @mironb,

Refer below link for all kind of date conversion
All about Datetime - UiPath - News / Tutorials - UiPath Community Forum

Regards,
Arivu

Hi @mironb ,
assign the date value to string argument as strDate
DateTime.ParseExact(strDate, "dd.MM.yy", System.Globalization.CultureInfo.InvariantCulture).Tostring("dd/MM/yy")

Regards,
Arivu

@mironb,

Instead of the static value you can use the variable.

DateTime.ParseExact(yourDateValue, "dd.MM.yy", System.Globalization.CultureInfo.InvariantCulture).Tostring("dd/MM/yy")

image

@mironb,

Change your variable name to something else instead of “DateTime”

image

not “Dt” please mention Datetime.ParseExtract

DateTime.ParseExact(Dt.ToString(), "dd.MM.yy", System.Globalization.CultureInfo.InvariantCulture).Tostring("dd/MM/yy")

Regards,
Arivu

Thank you very much

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