Skip to main content
Solved

Using dates in formulas

  • July 6, 2026
  • 3 replies
  • 24 views

I would like to use a specific date in a formula for a condition; for example:

 

if (date < exchange_date, constant1 * tag1, constant 2 * tag1)

I tried this with TM_day, TM_month tags, but they don't give the exact months/dates when using in a formular (perhaps because they are converted from strings?)

Best answer by Wouter Daniels

Indeed, the text tags are not very useful for this purpose.

To narrow it down to an exact, arbitrary timestamp in a formula, conceptually the easiest option is to use a tag which gives the epoch unix timestamp which shows the number of seconds since 1970. You can then use a convertor to convert your specific date into a timestamp and enter this into a formula. This way you only need a single tag. Example:

if(epoch < 1783363457, 10*tag1, 100*tag1)

 

Attached you can find a csv file which you can import into the tag builder for an epoch tag.

 

3 replies

Wouter Daniels
Employee
Forum|alt.badge.img

Indeed, the text tags are not very useful for this purpose.

To narrow it down to an exact, arbitrary timestamp in a formula, conceptually the easiest option is to use a tag which gives the epoch unix timestamp which shows the number of seconds since 1970. You can then use a convertor to convert your specific date into a timestamp and enter this into a formula. This way you only need a single tag. Example:

if(epoch < 1783363457, 10*tag1, 100*tag1)

 

Attached you can find a csv file which you can import into the tag builder for an epoch tag.

 


Kevin
Employee
Forum|alt.badge.img
  • Employee
  • July 6, 2026

Hi - thank you for your question.

You are correct about the TM time tags being converted from string to analog when used in a formula. When converted, they are not guaranteed to be in chronological order.

The workaround is to import a tag that mirrors the date — a numeric date tag, e.g. an integer in YYYYMMDD form (20260315 = 15 Mar 2026). Once that tag exists, you can reference it in the formula and compare against a fixed number:

if( [date_tag] < 20260315, constant1 * [tag1], constant2 * [tag1] )

Hope this helps and please let us know if you have any follow-up questions!


  • Author
  • Navigator
  • July 7, 2026

Thanks - worked well!