AnsweredAssumed Answered

Date calculation for the days of last month

Question asked by gregc72 on May 11, 2018
Latest reply on May 23, 2018 by graham

I am trying to create a site workflow that runs at the beginning of each month that looks at a list and counts the entries for the previous month.


I created the logic to figure out the numbers for the month number of the last month, the year of last month (January would be year - 1) and the end day of last month depending on the month. My goal was to use these numbers to create a start date (mm/01/yyy) and end date (mm/dd/yyyy) but I can't seem to figure out how to create a date from those numbers. Setting them as a variable date doesn't work, calculate date doesn't work because you would have to have 0/00/0000 which it sees as blank. 


If I run it on the first of each month I could get the begin date by the current date - one month and the end date by subtracting one day from the beginning of the month. But, I want to be able to run this say on the 2nd or 3rd of the month manually if need be also, which wouldn't work.


Anyone able to suggest the best way to go about this?