# 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

Arguments:

Arguments

| 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 dtat load script or the operating system<br>is used. |

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FormattingFunctions/Date.htm)

#### Examples and results:

The examples below assume the following default settings:

* Date setting 1: YY-MM-DD
* Date setting 2: M/D/YY

Example:

`Date( 
 A )`   
where A=35648

Results table

| Results | Setting 1 | Setting 2 |
| --- | --- | --- |
| String: | 97-08-06 | 8/6/97 |
| Number: | 35648 | 35648 |

Example:

`Date( 
 A, 'YY.MM.DD' )`   
  
where A=35648

Results table

| Results | Setting 1 | Setting 2 |
| --- | --- | --- |
| String: | 97.08.06 | 97.08.06 |
| Number: | 35648 | 35648 |

Example:

`Date( A, 
 'DD.MM.YYYY' )`   
where A=35648.375

Results table

| Results | Setting 1 | Setting 2 |
| --- | --- | --- |
| String: | 06.08.1997 | 06.08.1997 |
| Number: | 35648.375 | 35648.375 |

Example:

`Date( 
 A, 'YY.MM.DD' )`   
where A=8/6/97

Results table

| Results | Setting 1 | Setting 2 |
| --- | --- | --- |
| String: | NULL (nothing) | 97.08.06 |
| Number: | NULL | 35648 |