How to get two previous months

Hi, please can anyone help me?
How can i get two previous months, when i use “new DateTime(now.Year,now.Month-2,1).ToString(“dd.MM.yyyy”)” but it doesn’t work (error Year,month and day parameters describe an un-representable Datetime).


Welcome to our uipath community.

Try this.


new DateTime(now.Year,now.AddMonths(-2),1).ToString(“dd.MM.yyyy”)
error: value of type ‘date’ cannot be converted to ‘integer’.


Have you tried above mentioned expression ?


it works ! Thank you!

1 Like

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