Get the previous month from the current date

Hi so I need to get Today´s date in order to extract the current month and after that getting the previous month.
For example: Today it´s 11/08/2021
I will need to get that 11 and substract 1 to get 10 wich corresponds to OCTOBER.
What can I do?
Thanks and Regards.

CDate(“11/08/2021”).Month -1 would return 10


Yes, but how could I make it instead of putting (“11/08/2021”) To get the current date no matter if the bot runs today or in two months?
In Studio it will be Today.ToString, but doesn´t work for studioX

You can convert the string to date and use addmonth function with value as -1

Convert string to date:


On a date time variable you’ll be able to the function add month

if your actual requirement is also for today’s date
Then simply use Now.Date.Addmonth(-1)

have a check on the Visuals from above and here:

Woul it work for StudioX?
Could you provide a screenshot ?
This is what appears to be the Assign activity for StudioX


Can you try the following steps?

1. In left side, click “Save For Later” then input its name.
2.Click Advanced Editor and modify ExcelValue to Int32 as the following.


3.In right side, open advanced editor, then input the following expression