date function
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.
Parameters
date(year, month, day)
Parameter | Description |
---|---|
year | The integer attribute containing the year from which we want to cast a date. The year parameter is mandatory. |
month | The integer attribute containing the month. Set to 0 as default. |
day | The integer attribute containing the day. Set to 0 as default. |
Integer type valid formats (if the values aren’t this format, the function will return an error).
45;
-44
Example
The following example uses the Instagram_data dataset.
Description | Screenshot |
---|---|
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:
|