Skip to main content Skip to complementary content

Date# - script and chart function

Date# evaluates an expression as a date in the format specified in the second argument, if supplied.

Syntax:  

Date#(text[, format])

Return data type: dual

Arguments
Argument Description
text The text string to be evaluated.
format

String describing the format of the text string to be evaluated. If omitted, 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)

Descriptions for number and time formats

Example: Chart expressions
Example Result
Date#('8/7/97') Returns a valid date of 8/7/97 when the DateFormat setting is M/D/YY.
Date#('21.10.2023', 'DD.MM.YYYY' ) Returns a valid date of 21.10.2023 when the date setting is DD.MM.YYYY.
Date#('21.10.2023') Returns NULL when the DateFormat setting is M/D/YY.

Example - Date# fundamentals

Example - Date# scenario

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!