You are viewing limited content. For full access, please sign in.

Question

Question

How to get the month before?

asked on June 22, 2018

Hi all,

 

I'm trying to get the month before.

Using a Token, I can get the actually month

Token = %(Date#<(\d{2}).\d{4}>#).

Now I want to get the month before and IDK how to do.

I tried with Token Calculator but I don't really know how to use it.

 

Need some helps please.

Thank you very much.

Regards

0 0

Answer

SELECTED ANSWER
replied on June 22, 2018

First, you don't need to use pattern matching to extract the date. Workflow's token editor has formatting rules specifically for date/time values so you can extract certain pieces (see here).

If you want the numeric value of the previous month, use a Date Token Calculator, set to "Specific Date"

The formatting rules will automatically extract the month, day, and year from the default "Date" token to provide an example.

Set the day to 1, since you only want the month value anyway, and set it to Subtract 1 Month.

The end result will be a date set to the first day of the previous month (even if it is in the previous year) and you can use the formatting again to extract just the month.

 

 

5 0

Replies

replied on June 22, 2018

Thank you Jason,

 

This is awesome!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.