The date function returns a column with all values equal to the date consisting of given year, month and day. This description is valid only when the formula is filled with the year mandatory parameter and at least one optional parameter.
This function returns completely different results when working using the year parameter only:
In this use case, the year parameter represents the number of days to add to the default Rulex date, which is 1899-12-30, in order to return the corresponding date.
date(year, month, day)
The integer attribute containing the year from which we want to cast a date. The year parameter is mandatory.
The integer attribute containing the month. Set to 0 as default.
The integer attribute containing the day. Set to 0 as default.
The following example uses the Instagram_data dataset.
In this example we want to retrieve the date by concatenating the year, month and day, to create an attribute containing the date posted.
Add a new attribute, called date, and type the following formula:
As we have specified not only the mandatory parameter, but also the optional parameters, the function concatenates the values to create a date.
If we wanted to use this function specifying the year parameter only, we want to retrieve the date after the number of days indicated in the year parameter, according to Rulex default date (1899-12-30).
Add a new attribute, called Rulex date, and type the following formula:
The results have to be read as follows: