Rules --> Time and Date Expressions -->

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,
  • addWeeks: adds a specific amount of weeks (7 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’.

The RBLang below will generate the a map that uses the different expressions mentioned in the article. Click on ‘Export .rbird’ to download the knowledge map, or ‘copy RBLang’ and paste the code directly into Rainbird.

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