Help Centre › Functions & Formulas
For a full list of available calculation functions, please read What calculation functions are supported.
Description
The DATE function is like a date constructor. It takes separate values for year, month, and day, and combines them into a single date.
Syntax
DATE(year,month,day)
The DATE function syntax has the following arguments:
- Year Required. The value of the year argument can include one to four digits. The RPA interprets the year argument according to the date system your computer is using. By default, the RPA uses the 1900 date system, which means the first date is January 1, 1900.
Tip: Use four digits for the year argument to prevent unwanted results. For example, "07" could mean "1907" or "2007." Four-digit years prevent confusion.- If year is between 0 (zero) and 1899 (inclusive), the RPA adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108).
- If the year is between 1900 and 9999 (inclusive), the RPA uses that value as the year. For example, DATE(2008,1,2) returns January 2, 2008.
- If the year is less than 0 or is 10000 or greater, the RPA returns the #NUM! error value.
- Month Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).
- If the month is greater than 12, the month adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns the serial number representing February 2, 2009.
- If the month is less than 1, the month subtracts the magnitude of that number of months, plus 1, from the first month in the year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.
- Day Required. A positive or negative integer representing the day of the month from 1 to 31.
- If the day is greater than the number of days in the month specified, the day adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns the serial number representing February 4, 2008.
- If the day is less than 1, the day subtracts the magnitude of that number of days, plus one, from the first day of the month specified. For example, DATE(2008,1,-15) returns the serial number representing December 16, 2007.
Note: The RPA stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900, is serial number 1, and January 1, 2008, is serial number 39448 because it is 39,447 days after January 1, 1900.
Errors
For a full list of formula errors, please read Formula errors.