Convert string to date type and subtract months from it

Hi All,
I have a string “09/23/2019” from which I need to subtract months which can be 6,12 or 18 and the result extracted after deducting months need to be passed on webpage.
The webpage field accepts “mm/dd/yyyy” format.

1 Like

Fine
If the input string is in this format
str_input = “09/23/2019”

Then
str_output = DateTime.ParseExact(str_input,”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddMoths(-2).ToString(“MM/dd/yyyy”)

Where -2 can be replaced with any int32 variable
hope this would help you resolve this
Cheers @somya177

Hello @somya177

thank you for your inquiry :slight_smile:

please take a look that I have added an input activity in case you want to try the substraction.

image

Here is the xaml for you to try

Convert string to date type and subtract months from it.xaml (5.5 KB)

Regards,


Don’t forget to like us :heartpulse:
Happy Automation! :sunglasses:

1 Like

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