Get previous month's value and number of days



(1)Is there a way to get the value of the previous month by date manipulation?
Ex) If this month is July 2017, we will acquire 06.
If this month is January 2017, you will get 12.

(2)Is there a way to get the number of days for the month information I got?
Ex) 06 case 30, 12 case 31 is acquired.

The processing that we want to realize with UiPath is as follows.

Every month At the beginning of the month, only the file name of the previous month is copied from the files of the specific folder.

Ex1) In the case of July 2017, only 20170601.csv to 20170630.csv (30 files) of file 20170101.csv to file 20170630.csv (181 files) are copied to another folder.

Ex2) When current is January 2017, copy only 20161201.csv to 20161231.csv (31 files) of file 20160101.csv to file 20161231.csv (366 files) to another folder.


you can try this with assign,
int lastMonth = DateTime.Now.AddMonths(-1).Month;


get the days in month,

int days = DateTime.DaysInMonth(year, month);



Thank you for your replies.
I’ll try them.