# Interval - 指令碼與圖表函數

Interval() 會使用載入指令碼中的系統變數或作業系統中的格式，或格式字串 (如果提供)，將數字設定為時間間隔格式。

可以將間隔設定為時間、日期，或日期、小時、分鐘、秒和秒分數的組合。

語法：

Interval(number[, format])

傳回的資料類型： 雙值

引數：

Interval 引數

| 引數 | 描述 |
| --- | --- |
| number | 要設定格式的數字。 |
| format | 說明如何對所產生間隔字串進行格式設定的字串。如果省略，則會使用作業系統中設定的簡短日期格式、時間格式和小數點分隔符號。 |

範例：

以下的範例假設下列預設設定：

* 日期格式設定 1： YY-MM-DD
* 日期格式設定 2： hh:mm:ss
* 數字小數點分隔符號：

範例與結果

| 範例 | 字串 | 數字 |
| --- | --- | --- |
| `Interval(   A )`<br><br>其中 A=0.375 | 09:00:00 | 0.375 |
| `Interval( A )`<br><br>其中 A=1.375 | 33:00:00 | 1.375 |
| `Interval( A, 'D hh:mm' )`<br><br>其中 A=1.375 | 1 09:00 | 1.375 |
| `Interval(   A-B, 'D hh:mm' )`<br><br>其中 A=97-08-06 09:00:00 and B=96-08-06 00:00:00 | 365 09:00 | 365.375 |