Date Functions
Calculated Attribute expressions can be written using the following available functions. Use Cases follow the available functions table.
Note: Date functions require that date values are entered in yyyy- MM- dd or yyyy- MM- dd HH:mm:ss formats. 'ISO Date' and 'ISO Date and Time' validation base type attributes accept only these formats.
Date Function |
Parameters |
Description |
---|---|---|
FORMATDATETIME |
(date, format-string[, locale]) |
Determine the output by formatting a date according to the format-string, refer to documentation for SimpleDateFormat for Oracle on the web. [locale] is optional; refer to Using a Locale below |
LOCALIZEDATE |
(date[, locale]) |
Localize the date to a string using the locale in the current / extracting / resolving context, or using the supplied locale. [locale] is optional; refer to Using a Locale below |
NOW |
() |
Returns current time on server in yyyy-MM-dd HH:mm:ss format. |
CONVERTDATETODAYNUMBER | (date in ISO format) | Converts an ISO date (YYYY-MM-DD) to a day number where Jan 0, 1900 is used as the benchmark. For example, convertdatetodaynumber ('2019-07-02') would return a value of 43648. |
CONVERTDAYNUMBERTODATE | (integer) | Converts a day number to an ISO date (YYYY-MM-DD) where Jan 0, 1900 is used as the benchmark for the day number. For example, convertdaynumbertodate (43648) would return an ISO date of 2019-07-02. |
Using a Locale
To obtain a date or date / time format for a specific locale, in order to override the locale that is specified by the current context, enter the locale's ID and ensure the following property is defined in the sharedconfig.properties file:
Calculated.UseLegacyLocalization=true
For more information on locales, refer to Context Locales documentation in this guide here.
Use Cases
For examples of these functions, refer to Date Examples here.