Date
The DATE function returns the sequential serial number that represents a particular date. For example, the formula
=DATE(2008,7,8)
returns 39637, the serial number that represents 7/8/2008.
The DATE function is most useful in situations where the year, month, and day are supplied by formulas or field references. For example, you might have a form that contains dates in a format that GoFormz does not recognize, such as YYYYMMDD. You can use the DATE function in conjunction with other functions to convert the dates to a serial number that GoFormz recognizes. See the table in the Example section of this article for more information.
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. GoFormz interprets the year argument according to the date system your computer/mobile device is using. By default, GoFormz uses the 1900 date system.
- We recommend using 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), GoFormz adds that value to 1900 to calculate the year. For example,
DATE(108,1,2)
returns January 2, 2008 (1900+108). - If year is between 1900 and 9999 (inclusive), GoFormz uses that value as the year. For example,
DATE(2008,1,2)
returns January 2, 2008.
-
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, 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 month is less than 1, 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.
- If month is greater than 12, month adds that number of months to the first month in the year specified. For example,
-
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 GoFormz 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.
Example
Create the following 4 fields with these values in the Default Value of each field:
Year | Month | Day | Date |
---|---|---|---|
2011 | 1 | 1 | 20111125 |
Formula | Description | Result |
---|---|---|
=DATE([Year],[Month],[Day]) | Serial date for the date derived by using fields Year, Month, and Day as the arguments for the DATE function. | 40544 |
=DATE(YEAR(NOW()),12,31) | Serial date for the last day of the current year. | 41274 |
=DATE(LEFT([Date],4), MID([Date],5,2), RIGHT([Date],2)) Formatting: mm/dd/yyyy | A formula that converts the text string in [Date] (20111125) representing a date in a "YYYYMMDD" format to a date. | 11/25/2011 |
Updated almost 2 years ago