Convert to date

for example: actualdate = “12 Nov 2022” (not taking today’s date)
preparedate = 12 nov 2022 - 2days = 10 Nov 2022
how should I do it using uipath?

preparedate = actualdate - 2days = 10 Nov 2022

HI @llllllkt99

Try with this expression

DateTime.ParseExact("12 Nov 2022","dd MMM yyyy",System.Globalization.CultureInfo.InvariantCulture).AddDays(-2).ToString("dd MMM yyyy")

Regards
Gokul

Output Screenshot @llllllkt99

image

Regards
Gokul

Hi,

The following might be better if date style is not 09 but 9 like “9 Nov 2022”, for example.

DateTime.ParseExact("12 Nov 2022","d MMM yyyy",System.Globalization.CultureInfo.InvariantCulture).AddDays(-2).ToString("d MMM yyyy")

Regards,

may I know what will be the variable type?

HI @llllllkt99

Variable Type should have String I think actualdate variable type is String

preparedate  = DateTime.ParseExact(actualdate.ToString,"dd MMM yyyy",System.Globalization.CultureInfo.InvariantCulture).AddDays(-2).ToString("dd MMM yyyy")

Regards
Gokul

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