Date - script and chart function
Date() formats an expression as a date using the format set in the system variables in the data load script, or the operating system, or a format string, if supplied.
Syntax:
Date(number[, format])
Return data type: dual
Argument | Description |
---|---|
number | The number to be formatted. |
format |
String describing the format of the resulting string. If no format string is supplied, the date format set in the system variables in the data load script or the operating system
is used.
The Date function supports many format options for different date structures, for example: DD/MM/YYYY: Day/Month/Year (for example, 15/02/2022) MM-DD-YYYY: Month-Day-Year with hyphens (for example, 02-15-2022) YYYY-MM-DD: Year-Month-Day, ISO format (for example, 2022-02-15) D-MMM-YYYY: Day, short Month name, Year, with hyphens (for example, 15-Feb-2022) MMMM YYYY: Long Month name and Year (for example, February 2022) MM/YYYY: Month and Year (for example, 02/2022) DD MMMM YYYY: Day, long Month name, and Year (for example, 15 February 2022) |
Example | Result |
---|---|
Date( 35648 ) | Returns 97-08-06 when the DateFormat setting is YY-MM-DD. |
Date( 35648, 'YY.MM.DD' ) | Returns 97.08.06 when the DateFormat setting is YY-MM-DD. |
Date( '8/6/97', 'YY.MM.DD' ) | Returns NULL when the DateFormat setting is YY-MM-DD. |