Time and Date Expressions – addDays / addWeeks / addMonth / addYears

addDays / addWeeks / addMonth / addYears

In Rainbird, concepts can be ‘date’ concepts.  Date concepts should be used when a date will be either input into or output by Rainbird. Dates in Rainbird are formatted as YYYY-MM-DD (e.g. 1st of March 2021 would be formatted as 2021-03-01).

Rainbird can use date expressions to transform and calculate datesDate expressions can be combined with other date, transformative and comparative expressions to ‘retrieve’, ‘add’,  ‘subtract’ or ‘compare’ time

The expressions discussed in this article are used by Rainbird to add or subtract a value to or from a date instance that has been created at runtime by the end-user or that exists as a fact in a knowledge map. 

The expressions discussed in the article are:

  • addDays: adds a specific amount of days to a date,
  • addDays: adds a specific amount of days to a date,
  • addMonths: adds a specific amount of months to a date
  • addYears: adds a specific amount of years to a date

The above expressions are unlikely to be used in isolation. They can be used with other date expressions, for example, the ‘today’s date’ expression

Click on an expression below for instructions on how to build a rule that uses that expression:

When viewing the map generated by the RBLang at the bottom of the article, for a demonstration of the addDays function, please run the query on the ‘day before yesterday’ relationship.

When viewing the map generated by the RBLang at the bottom of the article, for a demonstration of the addWeeks function, please run the query on the ‘add two weeks’ relationship.

When viewing the map generated by the RBLang at the bottom of the article, for a demonstration of the addMonths function, please run the query on the ‘add 9 months’ relationship.

When viewing the map generated by the RBLang at the bottom of the article, for a demonstration of the addYears function, please run the query on the ‘add 10 years‘ relationship.

IMPORTANT: Date instances should be formatted as ‘YYYY-MM-DD’.

Click on the ‘Export.rbird’ button to download the ‘addDays’ map used in this example. The knowledge map can then be imported into your Rainbird Studio.

Query and Results

Each function used in the article has a separate relationship between the ‘start point’ and ‘date concept’ concepts that needs to be run to get an example of the function in action.

Article Feedback form
Did you find this article useful?

Version 1.01 – Last Update: 01/03/2021