YEAR Function in TM1: Syntax and Use
The Year function in TM1 extracts a numeric version of the year from a text string that represents a date, where the date has been presented in either YYYY-MM-DD or YY-MM-DD format. It is similar to the “extract” SQL function when combined with the “year” operator.
For example, if you have a date of ‘2017-11-28′, this function will return the number 17 (not the string ’17’).
Syntax of the YEAR Function
The syntax is:
Year ( date );
- date is the string or text version of a date in either YYYY-MM-DD or YY-MM-DD format.
An example of its use is where we have a date index that we know, let’s say the index associated with the date 9-Mar-1998, which is 13947. We then have a variable called sDate and into it we store the string date associated with that index by using the DATE function.
sDate = Date (13947 , 1); Year ( sDate);
This will return the number 98 (for 1998), which can then be used in numeric calculations.
This function can be used in Rules and Turbo Integrator processes.