How to get previous month or next month based on current date in Nintex workflows? Please help

  • 15 November 2017
  • 3 replies
  • 95 views

Badge +1

I have a field where we store month like January, February.. December.. I have a requirement to fetch last month records. I am trying to get previous month based on current date. But unable. To figure out how to do that. Is there an easy function where I can add / subtract and get desired month based on current date? 


3 replies

Userlevel 4
Badge +12

Did you have a look into the calculate date action? You can use the current date as base and then enter -1 into the month field. This will subtract one month from the date and return it as a date variable that you can use.

you can also do this with positive values which will add a month.

I understood that you have saved the date in your list with full month names, like January, February and so on.

You can add a set variable action after you calculated the date and set a text variable (Like month name) with the following inline function

fn-FormatDate(yourcalculateddate, “MMMM“)

This will convert your date to a text containing only the name of the month name of that date.

Hope this helps a bit.

Best regards,

Enrico

Badge +1

Oh, I see what you are saying. So I use calculate date action and set month as - 1 based on action execution date, get the date, and use formatdate function to convert date in actual month string. Trying it out now. Thank you so much for guidance happy.png 

Badge +1

That did the trick. Thank you happy.png 

Reply