# quarterend 指令碼與圖表函數

此函數傳回的值相當於包含 date 的季度的最後一毫秒的時間戳記。預設的輸出格式為指令碼中所設定的 DateFormat。

QuarterEnd(date[, period\_no[, first\_month\_of\_year]])

傳回的資料類型： 雙值

`quarterend()` 函數的圖表

`quarterend()` 函數的圖表

`quarterend()`quarterend() 函數的圖表 ![Diagram that shows how the quarterend() function identifies the quarter that a date falls into and that it returns the last day of that quarter.](https://help.qlik.com/zh-TW/sense/May2026/Subsystems/Hub/Content/Resources/Images/scripting-functions-quarterend-diagram1.png)

`quarterend()` 函數判定日期落在哪一季。然後以日期格式傳回該季最後一個月的最後一毫秒的時間戳記。依照預設，該年的第一個月是 1 月。不過，您可以使用 `first_month_of_year` 函數中的 `quarterend()` 引數變更要將哪個月設為第一個月。

資訊備註`quarterend()` 函數不考慮 `FirstMonthOfYear` 系統變數。該年從 1 月 1 日開始，除非使用 `first_month_of_year` 引數變更。

什麼情況下使用

`quarterend()` 函數在您想要計算以使用一季中尚未發生的部分時，通常作為運算式的一部分使用。例如，若您想要計算該季期間尚未發生的總利息。

引數

| 引數 | 描述 |
| --- | --- |
| date | 要評估的時間戳記。 |
| period\_no | period\_no 為整數，值 0 表示是包含 date 的季度。負值的 period\_no 表示之前的季度，正值表示之後的季度。 |
| first\_month\_of\_year | 如果要使用不起始於 1 月的 (會計) 年度，可在 first\_month\_of\_year 中指定介於 2 和 12 之間的值。 |

您可以在 `first_month_of_year` 引數中使用下列值設定一年的第一個月：

first\_month\_of\_year 值

| 月 | 值 |
| --- | --- |
| 二月 | 2 |
| 三月 | 3 |
| 四月 | 4 |
| 五月 | 5 |
| 六月 | 6 |
| 七月 | 7 |
| 八月 | 8 |
| 九月 | 9 |
| 十月 | 10 |
| 十一月 | 11 |
| 十二月 | 12 |

## 區域設定

除非另有說明，否則此主題中的範例皆使用下列日期格式：MM/DD/YYYY。日期格式是在資料載入指令碼的 `SET DateFormat` 陳述式中指定。由於地區設定和其他因素，您系統中的預設日期格式可能會不同。您可以變更以下範例中的格式，以滿足您的需求。或者，您可以在載入指令碼中變更格式，以符合這些範例。

應用程式中的預設地區設定是根據安裝 Qlik Sense 之電腦或伺服器的地區系統設定。若您存取的 Qlik Sense 伺服器設定為瑞典，資料載入編輯器將會對日期、時間和貨幣使用瑞典文地區設定。這些地區格式設定與 Qlik Sense 使用者介面中顯示的語言無關。Qlik Sense 將會以您正在使用的瀏覽器語言顯示。

函數範例

| 範例 | 結果 |
| --- | --- |
| `quarterend('10/29/2005')` | 傳回 12/31/2005 23:59:59。 |
| `quarterend('10/29/2005', -1)` | 傳回 09/30/2005 23:59:59。 |
| `quarterend('10/29/2005', 0, 3)` | 傳回 11/30/2005 23:59:59。 |

## 範例 1 - 基本範例

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

#### 載入指令碼和結果

概述

開啟資料載入編輯器並將下面的載入指令碼新增至新的區段。

載入指令碼包含：

* 包含一組 2022 年交易的 資料集，這載入到稱為「`Transactions`」的表格中。

* 前置載入 包含下列內容：

  * 設為「`end_of_quarter`」欄位並傳回交易發生該季結束之時間戳記的 `quarterend()` 函數。

  * 設為「`timestamp()`」欄位並傳回所選季結束之確切時間戳記的 `end_of_quarter_timestamp` 函數。

載入指令碼

```
SET DateFormat='MM/DD/YYYY'; 

Transactions: 
    Load 
       *, 
       quarterend(date) as end_of_quarter, 
       timestamp(quarterend(date)) as end_of_quarter_timestamp 
       ; 
Load 
* 
Inline  
[ 
id,date,amount 
8188,1/7/2022,17.17 
8189,1/19/2022,37.23 
8190,2/28/2022,88.27 
8191,2/5/2022,57.42 
8192,3/16/2022,53.80 
8193,4/1/2022,82.06 
8194,5/7/2022,40.39 
8195,5/16/2022,87.21 
8196,6/15/2022,95.93 
8197,6/26/2022,45.89 
8198,7/9/2022,36.23 
8199,7/22/2022,25.66 
8200,7/23/2022,82.77 
8201,7/27/2022,69.98 
8202,8/2/2022,76.11 
8203,8/8/2022,25.12 
8204,8/19/2022,46.23 
8205,9/26/2022,84.21 
8206,10/14/2022,96.24 
8207,10/29/2022,67.67 
]; 
```

結果

載入資料並開啟工作表。建立新的表格並將這些欄位新增為維度：

* `id`
* `date`
* `end_of_quarter`
* `end_of_quarter_timestamp`

結果表格

| ID | 日期 | end\_of\_quarter | end\_of\_quarter\_timestamp |
| --- | --- | --- | --- |
| 8188 | 1/7/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8189 | 1/19/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8190 | 2/5/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8191 | 2/28/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8192 | 3/16/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8193 | 4/1/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8194 | 5/7/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8195 | 5/16/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8196 | 6/15/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8197 | 6/26/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8198 | 7/9/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8199 | 7/22/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8200 | 7/23/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8201 | 7/27/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8202 | 8/2/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8203 | 8/8/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8204 | 8/19/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8205 | 9/26/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8206 | 10/14/2022 | 12/31/2022 | 12/31/2022 11:59:59 PM |
| 8207 | 10/29/2022 | 12/31/2022 | 12/31/2022 11:59:59 PM |

‘`end_of_quarter`’ 欄位在前置 LOAD 陳述式中的建立方式是使用 `quarterend()` 函數並傳遞日期欄位，作為函數的引數。

`quarterend()` 函數最初識別日期值落在哪一季，然後傳回該季最後一毫秒的時間戳記。

識別交易 8203 之季度結束的 `quarterend()` 函數圖表

識別交易 8203 之季度結束的 `quarterend()` 函數圖表

識別交易 8203 之季度結束的 `quarterend()`quarterend() 函數圖表 ![Diagram that shows the end of the quarter that the quarterend() function identifies by the transaction date of transaction 8203. The end of the quarter is returned as September 30.](https://help.qlik.com/zh-TW/sense/May2026/Subsystems/Hub/Content/Resources/Images/scripting-functions-quarterend-examples1_and3-diagram.png)

交易 8203 發生於 8 月 8 日。`quarterend()` 函數識別該交易發生在第三季，並傳回該季的最後一毫秒，即 9 月 30 日 11:59:59 PM。

## 範例 2 - period\_no

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

#### 載入指令碼和結果

概述

開啟資料載入編輯器並將下面的載入指令碼新增至新的區段。

載入指令碼包含：

* 包含一組 2022 年交易的資料集，這載入到稱為「`Transactions`」的表格中。

* 前置載入包含下列內容：

  * 設為「`quarterend()`」欄位並傳回交易發生的前一季結束之時間戳記的 `previous_quarter_end` 函數。

  * 設為「`timestamp()`」欄位並傳回交易發生的前一季結束之確切時間戳記的 `previous_end_of_quarter_timestamp` 函數。

載入指令碼

```
SET DateFormat='MM/DD/YYYY'; 

Transactions: 
    Load 
       *, 
       quarterend(date, -1) as previous_quarter_end, 
       timestamp(quarterend(date, -1)) as previous_quarter_end_timestamp 
       ; 
Load 
* 
Inline  
[ 
id,date,amount 
8188,1/7/2022,17.17 
8189,1/19/2022,37.23 
8190,2/28/2022,88.27 
8191,2/5/2022,57.42 
8192,3/16/2022,53.80 
8193,4/1/2022,82.06 
8194,5/7/2022,40.39 
8195,5/16/2022,87.21 
8196,6/15/2022,95.93 
8197,6/26/2022,45.89 
8198,7/9/2022,36.23 
8199,7/22/2022,25.66 
8200,7/23/2022,82.77 
8201,7/27/2022,69.98 
8202,8/2/2022,76.11 
8203,8/8/2022,25.12 
8204,8/19/2022,46.23 
8205,9/26/2022,84.21 
8206,10/14/2022,96.24 
8207,10/29/2022,67.67 
]; 
```

結果

載入資料並開啟工作表。建立新的表格並將這些欄位新增為維度：

* `id`
* `date`
* `previous_quarter_end`
* `previous_quarter_end_timestamp`

結果表格

| ID | 日期 | previous\_quarter\_end | previous\_quarter\_end\_timestamp |
| --- | --- | --- | --- |
| 8188 | 1/7/2022 | 12/31/2021 | 12/31/2021 11:59:59 PM |
| 8189 | 1/19/2022 | 12/31/2021 | 12/31/2021 11:59:59 PM |
| 8190 | 2/5/2022 | 12/31/2021 | 12/31/2021 11:59:59 PM |
| 8191 | 2/28/2022 | 12/31/2021 | 12/31/2021 11:59:59 PM |
| 8192 | 3/16/2022 | 12/31/2021 | 12/31/2021 11:59:59 PM |
| 8193 | 4/1/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8194 | 5/7/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8195 | 5/16/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8196 | 6/15/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8197 | 6/26/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8198 | 7/9/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8199 | 7/22/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8200 | 7/23/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8201 | 7/27/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8202 | 8/2/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8203 | 8/8/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8204 | 8/19/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8205 | 9/26/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8206 | 10/14/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8207 | 10/29/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |

因為 `period_no` 的值 `-1` 作為 `quarterend()` 函數中的偏移引數使用，所以該函數首先會識別交易發生的季。然後這會往前偏移一季並識別該季的最後一毫秒。

具有 period\_no 值 -1 的 `quarterend()` 函數圖表

具有 period\_no 值 -1 的 `quarterend()` 函數圖表

具有 period\_no 值 -1 的 `quarterend()`quarterend() 函數圖表 ![Diagram that shows the end of the quarter that the quarterend() function identifies by the transaction date of transaction 8203. The end of the quarter is returned as June 30 because a period_no of -1 is used.](https://help.qlik.com/zh-TW/sense/May2026/Subsystems/Hub/Content/Resources/Images/scripting-functions-quarterend-example2-diagram.png)

交易 8203 發生於 8 月 8 日。`quarterend()` 函數識別交易發生的前一季介於 4 月 1 日和 6 月 30 日之間。然後該函數會傳回該季的最後一毫秒 6 月 30 日 11:59:59 PM。

## 範例 3 - first\_month\_of\_year

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

#### 載入指令碼和結果

概述

開啟資料載入編輯器並將下面的載入指令碼新增至新的區段。

載入指令碼包含：

* 包含一組 2022 年交易的資料集，這載入到稱為「`Transactions`」的表格中。

* 前置載入包含下列內容：

  * 設為「`quarterend()`」欄位並傳回交易發生該季結束之時間戳記的 `end_of_quarter` 函數。

  * 設為「`timestamp()`」欄位並傳回所選季結束之確切時間戳記的 `end_of_quarter_timestamp` 函數。

不過，在此範例中，公司政策適用於會計年度在 3 月 1 日開始的情況。

載入指令碼

```
SET DateFormat='MM/DD/YYYY'; 

Transactions: 
    Load 
       *, 
       quarterend(date, 0, 3) as end_of_quarter, 
       timestamp(quarterend(date, 0, 3)) as end_of_quarter_timestamp 
       ; 
Load 
* 
Inline  
[ 
id,date,amount 
8188,1/7/2022,17.17 
8189,1/19/2022,37.23 
8190,2/28/2022,88.27 
8191,2/5/2022,57.42 
8192,3/16/2022,53.80 
8193,4/1/2022,82.06 
8194,5/7/2022,40.39 
8195,5/16/2022,87.21 
8196,6/15/2022,95.93 
8197,6/26/2022,45.89 
8198,7/9/2022,36.23 
8199,7/22/2022,25.66 
8200,7/23/2022,82.77 
8201,7/27/2022,69.98 
8202,8/2/2022,76.11 
8203,8/8/2022,25.12 
8204,8/19/2022,46.23 
8205,9/26/2022,84.21 
8206,10/14/2022,96.24 
8207,10/29/2022,67.67 
]; 
```

結果

結果表格

| ID | 日期 | end\_of\_quarter | end\_of\_quarter\_timestamp |
| --- | --- | --- | --- |
| 8188 | 1/7/2022 | 02/28/2022 | 2/28/2022 11:59:59 PM |
| 8189 | 1/19/2022 | 02/28/2022 | 2/28/2022 11:59:59 PM |
| 8190 | 2/5/2022 | 02/28/2022 | 2/28/2022 11:59:59 PM |
| 8191 | 2/28/2022 | 02/28/2022 | 2/28/2022 11:59:59 PM |
| 8192 | 3/16/2022 | 05/31/2022 | 5/31/2022 11:59:59 PM |
| 8193 | 4/1/2022 | 05/31/2022 | 5/31/2022 11:59:59 PM |
| 8194 | 5/7/2022 | 05/31/2022 | 5/31/2022 11:59:59 PM |
| 8195 | 5/16/2022 | 05/31/2022 | 5/31/2022 11:59:59 PM |
| 8196 | 6/15/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8197 | 6/26/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8198 | 7/9/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8199 | 7/22/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8200 | 7/23/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8201 | 7/27/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8202 | 8/2/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8203 | 8/8/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8204 | 8/19/2022 | 08/31/2022 | 8/31/2022 11:59:59 PM |
| 8205 | 9/26/2022 | 11/30/2022 | 11/30/2022 11:59:59 PM |
| 8206 | 10/14/2022 | 11/30/2022 | 11/30/2022 11:59:59 PM |
| 8207 | 10/29/2022 | 11/30/2022 | 11/30/2022 11:59:59 PM |

在此例中，因為 `first_month_of_year` 引數 `3` 用於 `quarterend()` 函數，該年的開始會從 1 月 1 日移至 3 月 1 日。

3 月作為該年第一個月的 `quarterend()` 函數圖表

3 月作為該年第一個月的 `quarterend()` 函數圖表

3 月作為該年第一個月的 `quarterend()`quarterend() 函數圖表 ![Diagram that shows the end of the quarter that the quarterend() function identifies by the transaction date of transaction 8203. The end of the quarter is returned as September 30 because of the first month of the year is set to March.](https://help.qlik.com/zh-TW/sense/May2026/Subsystems/Hub/Content/Resources/Images/scripting-functions-quarterend-example3-diagram.png)

交易 8203 發生於 8 月 8 日。由於年度始於 3 月 1 日，因此年度的季度區段為 3 月-5 月、6 月-8 月、9 月-11 月及 12 月-2 月。

`quarterend()` 函數識別該交易發生 6 月開始和 8 月之間的季，並傳回該季的最後一毫秒，即 8 月 31 日 11:59:59 PM。

## 範例 4 - 圖表物件範例

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

#### 載入指令碼和圖表運算式

概述

使用與第一個範例相同的資料集和情境。

不過，在此範例中，資料集保持不變並且會載入到應用程式中。會建立傳回交易發生該季結束時間戳記的計算，作為應用程式圖表中的量值。

載入指令碼

```
SET DateFormat='MM/DD/YYYY'; 

Transactions: 
Load 
* 
Inline  
[ 
id,date,amount 
8188,1/7/2022,17.17 
8189,1/19/2022,37.23 
8190,2/28/2022,88.27 
8191,2/5/2022,57.42 
8192,3/16/2022,53.80 
8193,4/1/2022,82.06 
8194,5/7/2022,40.39 
8195,5/16/2022,87.21 
8196,6/15/2022,95.93 
8197,6/26/2022,45.89 
8198,7/9/2022,36.23 
8199,7/22/2022,25.66 
8200,7/23/2022,82.77 
8201,7/27/2022,69.98 
8202,8/2/2022,76.11 
8203,8/8/2022,25.12 
8204,8/19/2022,46.23 
8205,9/26/2022,84.21 
8206,10/14/2022,96.24 
8207,10/29/2022,67.67 
]; 
```

結果

載入資料並開啟工作表。建立新的表格並將這些欄位新增為維度：

* `id`
* `date`

若要計算交易發生的該季結束日期，建立下列量值：

* `=quarterend(date)`
* `=timestamp(quarterend(date))`

結果表格

| ID | 日期 | =quarterend(date) | =timestamp(quarterend(date)) |
| --- | --- | --- | --- |
| 8188 | 1/7/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8189 | 1/19/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8190 | 2/5/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8191 | 2/28/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8192 | 3/16/2022 | 03/31/2022 | 3/31/2022 11:59:59 PM |
| 8193 | 4/1/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8194 | 5/7/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8195 | 5/16/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8196 | 6/15/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8197 | 6/26/2022 | 06/30/2022 | 6/30/2022 11:59:59 PM |
| 8198 | 7/9/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8199 | 7/22/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8200 | 7/23/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8201 | 7/27/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8202 | 8/2/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8203 | 8/8/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8204 | 8/19/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8205 | 9/26/2022 | 09/30/2022 | 9/30/2022 11:59:59 PM |
| 8206 | 10/14/2022 | 12/31/2022 | 12/31/2022 11:59:59 PM |
| 8207 | 10/29/2022 | 12/31/2022 | 12/31/2022 11:59:59 PM |

‘`end_of_quarter`’ 欄位在前置 LOAD 陳述式中的建立方式是使用 `quarterend()` 函數並傳遞日期欄位，作為函數的引數。

`quarterend()` 函數最初識別日期值落在哪一季，然後傳回該季最後一毫秒的時間戳記。

識別交易 8203 之季度結束的 `quarterend()` 函數圖表

識別交易 8203 之季度結束的 `quarterend()` 函數圖表

識別交易 8203 之季度結束的 `quarterend()`quarterend() 函數圖表 ![Diagram that shows the end of the quarter that the quarterend() function identifies by the transaction date of transaction 8203. The end of the quarter is returned as September 30.](https://help.qlik.com/zh-TW/sense/May2026/Subsystems/Hub/Content/Resources/Images/scripting-functions-quarterend-examples1_and3-diagram.png)

交易 8203 發生於 8 月 8 日。`quarterend()` 函數識別該交易發生在第三季，並傳回該季的最後一毫秒，即 9 月 30 日 11:59:59 PM。

## 範例 5 - 情境

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

#### 載入指令碼和結果

概述

開啟資料載入編輯器並將下面的載入指令碼新增至新的區段。

載入指令碼包含：

* 資料集載入到稱為「Employee\_Expenses」的表格。該表格含有下列欄位：

  * 員工 ID

  * 員工名稱

  * 每個員工報銷的平均每日開支。

最終使用者希望圖表物件按員工 ID 和員工名稱顯示該季剩餘期間仍會產生的預估開支報銷。會計年度於 1 月開始。

載入指令碼

```
Employee_Expenses: 
Load 
* 
Inline  
[ 
employee_id,employee_name,avg_daily_claim 
182,Mark, $15 
183,Deryck, $12.5  
184,Dexter, $12.5 
185,Sydney,$27 
186,Agatha,$18 
]; 
```

結果

載入資料並開啟工作表。建立新的表格並將這些欄位新增為維度：

* employee\_id

* employee\_name

若要計算累積的利息，建立下列量值：

* =(quarterend(today(1))-today(1))\*avg\_daily\_claim

將量值的數字格式設定為金錢。

結果表格

| employee\_id | employee\_name | =(quarterend(today(1))-today(1))\*avg\_daily\_claim |
| --- | --- | --- |
| 182 | Mark | $480.00 |
| 183 | Deryck | $400.00 |
| 184 | Dexter | $400.00 |
| 185 | Sydney | $864.00 |
| 186 | Agatha | $576.00 |

quarterend() 函數使用今日日期作為其唯一引數，並傳回目前月份的結束日期。然後，以該年結束日期減去今日日期，運算式就會傳回此月剩餘天數。

然後按員工讓此值乘以平均每日開支報銷，以計算每個員工在該季剩餘期間預期會有的預估報銷值。