DATE
Returns a date value based on individual year, month, and day
Usage
DATE(year, month, day)
Parameters
year |
(Required) The year. Can be any number and is used as-is. |
month |
(Required) The month. A number between 1 and 12. |
day |
(Required) The day. A number between 1 and 31 that forms a valid date with the month and year. |
Examples
More information
The result you see here looks like the example itself. This is normal. This is the standard format the documentation
uses to indicate that a value is a date. This is to distinguish that case from a text that contains a
date, which would be "2019-02-04"
.
Differences with Excel’s DATE
function:
- Numbers with decimals are not accepted
- Negative months and days are not allowed
- There are limits on the year, the year -230495 is valid
This function is rarely needed, as other ways of getting a date value are often more practical:
- use the
@DATE_QUESTION
to set the variable - use a function that converts a text to a date:
DATEVALUE(text_date)
- use a function that returns a date:
TODAY()
orDATEADD(a_date, 5, "days")
Reminders
A text containing digits is not handled as a number. To have an actual number:
- use the
@NUMBER_QUESTION
to set the variable - write a numeric value directly in the code without quotes, ex:
age >= 18
- use a function which converts to a number:
NUMBER(text_containing_numbers)
- use a function which returns a number:
FIND("world", "hello everybody")