# Date# - script and chart function

Date# converts a text string to a numerical date by applying the provided date format pattern, or if omitted by the default date format pattern.

Syntax:

Date#(text[, format])

Return data type: dual

Arguments:

Date# arguments

| Argument | Description |
| --- | --- |
| text | The text string to be evaluated. |
| format | String describing the format that should be used to interpret the text string. If omitted, the date format set in the operating system<br>is used. |

Example:

The following example uses the date format M/D/YYYY. The date format is specified in the SET DateFormat statement at the top of the data load script.

Add this example script to your app and run it.

`Load *,` `Num(Date#(StringDate)) as Date;` `LOAD * INLINE [` `StringDate` `8/7/97` `8/6/1997` `];` ` `

If you create a table with StringDate and Date as dimensions, the results are as follows:

Example 1 results

| StringDate | Date |
| --- | --- |
| 8/7/97 | 35649 |
| 8/6/1997 | 35648 |