Rules --> Time and Date Expressions -->

dayOfWeek / dayOfMonth / dayOfYear / monthOfYear / year

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

If you want to use the outcome of a date expression’s calculation in further calculations, you will need to create the initial date expression on the relationship between the date concept that holds the date concept instances that will be used in the expression, and a number concept which the outcome of the expression will be assigned to.

The expressions discussed in this article are used by Rainbird to retrieve a required value from a date instance that has been created at runtime or that exists in the map.

The expressions discussed in this article are:
  • dayOfWeek: determines the day of the week as a numerical value (1-7, with Monday = 1, Tuesday = 2 etc)
  • dayOfMonth: extracts the day value from a date (e.g. Rainbird would extract 12 if the date instance was 12th of February 2021)
  • dayOfYear: counts the number of days a date is into a year (e.g. Rainbird would count 43 days if the date instance was 12th of February 2021)
  • monthsOfYear: determines the month of the year as a numerical value (1-12, with January = 1, February =2 etc)
  • year: extracts the year from a date (e.g. Rainbird would extract 2021 if the date instance was 12th of February 2021)
The above expressions are unlikely to be used in isolation. They can be used with other date expressions, for example, the addDays expression or the today’s date expression. Click on an expression below for instructions on how to build a rule that uses that expression:

In the knowledge map generated by the RBLang at the bottom of the article, please run the query on the  ‘wants to know day of week’ for an example of a query that uses the ‘dayOfWeek’ expression.

In the knowledge map generated by the RBLang at the bottom of the article, please run the query on the  ‘wants to know day in month’ for an example of a query that uses the ‘dayOfMonth’ expression.

In the knowledge map generated by the RBLang at the bottom of the article, please run the query on the  ‘wants to know number of days into a year’ for an example of a query that uses the ‘dayOfYear’ expression.

In the knowledge map generated by the RBLang at the bottom of the article, please run the query on the  ‘wants to know month of the year’ for an example of a query that uses the ‘monthOfYear’ expression.

In the knowledge map generated by the RBLang at the bottom of the article, please run the query on the  ‘wants to know year’ for an example of a query that uses the ‘year’ expression.

 
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 expression can be demoed in the knowledge map by running the query on the relationship mentioned at the end of each individual expression section in the article above.

Article Feedback form
Did you find this article useful?

Version 1.02 – Last Update: 29/03/2021

Bitnami