Date()
Category: Date
Syntax: Date ( month; day; year ) |
Parameters:
monthThe month of the year (a number from 1 to 12).
dayThe day of the month (a number from 1 to 31).
yearThe year (four digits between 0001 and 4000). The year parameter should be passed as a four-digit number; if not, FileMaker will not infer or prepend a century. (1/10/05 = January 10, 0005.)
Note that regardless of your system settings, this function requires that its parameters be listed strictly in order: month, day, year. Localizations settings will not apply.
Data type returned: Date
Description:
Returns a valid date of data type date represented by the three parameters.
Values for month and day outside of normal ranges will be interpreted correctly. For instance, a month value of 13 returns a date in January of the following year. A day value of 0 returns the last day of the preceding month.
Parameters can be calculation expressions or fields; as long as the final result is valid, the date function will work correctly. Dates are stored internally as numbers (a unit of "1" represents one day); whole number math can be done on dates.
Be sure when returning dates as the result of calculation fields that you specify a calculation result of Date. If you were to define a field as Date ( 1; 1; 2000) and were to set the calculation result as Number, then you would see 730120 as the calculation value. Internally, FileMaker stores dates as the number of days since January 1, 0001, and that internal representation is returned if you incorrectly specify the return data type.
Examples:
Function |
Results |
---|---|
Date ( 1; 1; 2000 ) |
Returns January 1, 2000 (formatting is determined on the layout and by system preferences). |
Math can be performed on dates: |
|
Date( 1; 1; 2000 ) - 1 |
Returns December 31, 1999. |
The parameters in a Date function can be calculated: |
|
Date ( Month ( Get ( CurrentDate )); 1; Year ( Get ( CurrentDate ))) |
Returns the date of the first of the current month; if today is August 12, 1965, then August 1, 1965 is returned. |
The parameters in a Date function can be fields: |
|
Date ( pickMonth; 1; Get ( CurrentDate )) |
Returns the date of the first of a month specified by the value in the field pickMonth. |