DATE
This function converts Converts a value of another data type into a date.
Syntax Code Block |
---|
DATE(string value, [format])
DATE(dateTime value) |
Inputs value - The value of the data type that is string of dateTime value to be converted to a date type. format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. "yyyy-MM-dd". For more info on specifying date format patterns, please see Date and time formats or patterns.
Default formats For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: string to date - yyyy-MM-dd. When the format is omitted the ISO-8601 date format yyyy-MM-dd (Most to least significant principle) is used for converting the value to a date. However we advice to use an explicit date format in your conversion function to avoid any confusion about the format used for conversion.
Return type Examples string to date conversion
- DATE("2021-02-18") results in a date value of 18-02-2021 (default format is used). "2024-07-22", "yyyy-MM-dd") converts the string value "2024-07-22" into a value of type date.
- DATE("0122/0107/20212024", "dd/MM/yyyy") results in a date value of 01-01-2021 (specified format is used). converts the string value "22/07/2024" into a value of type date.
Example dateTime to date conversion - Assume we have a dateTime attribute Person.TimeOfBirth
DATE(Person.TimeOfBirth) will return the date part of this attribute.
Info |
---|
| The way in which dates are displayed in the UI is determined by the date display formats, which can be configured per language code. For example the Dutch nl-NL date format could be configured as "dd-MM-yyyy", whereas the English en-US date format can be defined as "MM/dd/yyyy". The converted date in our example could look like "22-07-2024" when displayed in Dutch (nl-NL) and like "07/22/2024" when displayed in English (en-US). More information about language specific formats can be found in Reference Guide: Language formats. |
|