Working with Variables

Hello everyone,

I am still trying to figure out how to work with variabels.

I have a simple task:

{formdate: LL; name=eDatum} //get a date, save it

{time: MMMM D, YYYY; at={=eDatum}; shift=+30D} //shift date, BUT how can I save it again, name not working

I would like to use the 2.nd date. I would like to shift it to the next working day, Mon -Fri if nessesarry
But I cant use Logic in the date right?

@Dmitrij_Moreinis,

This is one that baffled me too when I was starting out with TB.

Here you go :slight_smile:

{formdate: LL; name=eDatum}
{newdate={time: MMMM D, YYYY; at={=eDatum}; shift=+30D}}

New date: {=newdate}

Thank you for the quick answer.
Is it possible to use logic?
I need still to shift the date to the next working day.
Can I use Logic with the Time?

Hi @Dmitrij_Moreinis,

Here is a snippet that I use to check if some dates are less or more than 30 days, with this example you can know how to use dates in your logic statements. Hope that it helps you working in your own snippets.

{formdate:MM/DD/YYYY; name=initial_date}

The selected date is {if:{time: X; at={=initial_date}; pattern=MM/DD/YYYY} > {time: X; at={time: MM-DD-YY}; pattern=MM-DD-YY; shift=-30D}}less than 30 days {else}more than 30 days {endif}from today

1 Like

Great snippet @Diego_Suancha.

@Dmitrij_Moreinis - with regards to working with business days, here's how you can do that:

{time: MMMM D, YYYY; shift=+1D(skip=SAT, SUN)}

The skip setting allows you to skip specific days of the week. Of course, this has its limitations because it doesn't take holidays into consideration. But it works for regular weekends.

So if we were to combine this with Diego's snippet, we could do something like this.

{formdate: MM/DD/YYYY; name=initial_date}

The selected date is {if: {time: X; at={=initial_date}; pattern=MM/DD/YYYY} > {time: X; at={time: MM-DD-YY}; pattern=MM-DD-YY; shift=-30D}}{time: MMMM D, YYYY; shift=+1D(skip=SAT, SUN)}{else}{time: MMMM D, YYYY}{endif}

In this case, if the date is less than 30 days away, you'll get the next working day. If not, you'll get the current day.

Make sense?

1 Like