Page 1 of 1

Rule for previous date

Posted: Fri Jan 13, 2023 11:59 am
by RonLat
Ist there a rule that can find a previous date?

For example on 28 Feb 2023 the previous date would be 31 Jan 2023.

Re: Rule for previous date

Posted: Fri Jan 13, 2023 12:12 pm
by gtonkin
I would suggest attributes for this as often you need prior day or prior business day.
These could be easily updated using TI and and spreadsheet send (with your workings for business/non-business days).

Re: Rule for previous date

Posted: Fri Jan 13, 2023 2:27 pm
by ascheevel
I second what George said. It seems you haven't fully shared the logic for your "previous date". If you want 2/28 to return 1/31, what should 2/27 return and 2/26, etc? Ignoring all of that, you could use the below code to have 2/28 return 1/31 in your specified output format via rules assuming you get your input date formatted properly.

Code: Select all

TIMST(DAYNO('2023-02-28') - Day('2023-02-28'), '\D \M \Y');
will return "31 JAN 2023". If you encapsulate the above in a CAPIT, it will return "31 Jan 2023"

If you're using TI, you can leverage the FormatDate to specify an input format and forgo converting the input to an acceptable format.