DATE function
This topic describes the formula syntax and usage of the DATE function in the Data Quality Execute Formula transform.
Description
Returns the sequential serial number that represents a particular 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. Data Integrity Suite interprets the year argument according to the date system your computer is using. By default, this is the 1900 date system, which means the first date is January 1, 1900.- If
year
is between 0 and 1899 (inclusive), the value is added to 1900 to calculate the year. For example,DATE(108,1,2)
returns January 2, 2008 (1900+108). - An error is generated if
year
is less than 0 or is 10000 or greater.
Tip: Use four digits for the year argument to prevent unwanted results. For example, "07" could mean "1907" or "2007." Four digit years are explicit.- If
month
Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December).- If
month
is greater than 12, that number of months is added to the first month in the specifiedyear
. - If
month
is less than one, that number of months plus 1 is subtracted from the first month in the specifiedyear
. For exampleDATE(2008,-3,2)
returns the serial number representing September 2, 2007.
- If
day
Required. A positive or negative integer representing the day of the month from 1 to 31.- If day is greater than the number of days in the month specified, 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 day is less than 1, day subtracts the magnitude 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.
- If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. For example,
Note
- Dates are stored as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, and July 16, 1969 is serial number 25400 because it is 25,400 days after January 1, 1900. The number format must be set to Date in output column to display a proper date. An output column set to Integer will show the sequential serial number.
Example
Formula:
DATE([Year],[Month],[Day])
Year | Month | Day | Result (date) | Result (integer) |
---|---|---|---|---|
1994 | 1 | 1 | 1994-01-01 | 34335 |
1994 | 4 | 14 | 1994-04-14 | 34438 |
1994 | 12 | 6 | 1994-12-06 | 34674 |