What is the syntax to count the months between current month and a date in a custom field?

William Arn March 29, 2021

My goal is to have Butler fill custom field {{%Pmts Made} with the difference between {{%First Payment} and the current month. I've tried the syntax 

when custom fields "First Payment" are completed, set custom field "Pmts Made" to "{date=1d}-{{%First Payment}"

but the field doesn't populate.

How can I accomplish this?

1 answer

0 votes
milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2021

@William Arn 

https://help.trello.com/article/1159-arithmetic-in-date-variables

my understanding is that you can adjust a CF date variable but you can subtract between two CF Date variables. However if you format dates as strings like ~YYYYMMDD you can do arithmetic on them like any other number CF but I does not handle cross month or year. There may be another format that can be used - I have to check. 

milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2021

@William Arn 

Based on the documentation there appears to be a unix timestamp using ~X. Have not have tried it. If it works you might have to divide by a denominator to cover from secs to say days. Let me know if this work for you. Can learn from you. 

milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 30, 2021

@William Arn 

I tried with ({date=2d~X} - {date=1d~X})/86400 and I set this into a number CF and got 1 which is the expected results to show that indeed you can use the Unix timestamp format to do the maths.

Working with real dates need a bit more investigation

( {{%Date@UTC~X}} - {date=1d@UTC~X} )/86400

print on comment using 

custom field date is {{%Date@UTC}} minus {date=1d@UTC} {time24}

gives you

custom field date is March 1, 2021 12:00 AM +08 minus March 1, 2021 +08 15:40

-0.6531944444444444 when multiply by 24 you get 15.67666 or 15 hrs and 40mins

So {date} it does take on an assumption of time based on current time

Hope this helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events