# Date# - 指令碼與圖表函數

Date# 會使用第二個引數中提供的格式 (如果提供的話)，將運算式評估為日期。

語法：

Date#(text[, format])

傳回的資料類型： 雙值

引數：

引數

| 引數 | 描述 |
| --- | --- |
| text | 要評估的文字字串。 |
| format | 描述待評估的文字字串格式之字串。如果忽略，將會使用資料載入指令碼的系統變數或作業系統中設定的日期格式。<br><br>[數字格式與時間格式的描述](https://help.qlik.com/zh-TW/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Introduction/conventions-number-time-formats.htm) |

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

#### 範例與結果：

下例使用日期格式 M/D/YYYY。日期格式在資料載入指令碼頂部的 SET DateFormat 陳述式中指定。

新增此範例指令碼到您的應用程式中並加以執行。

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

若您使用 StringDate和 Date 作為維度建立表格，結果將如下所示：

結果

| StringDate | 日期 |
| --- | --- |
| 8/7/97 | 35649 |
| 8/6/1997 | 35648 |