# 顯示中文星期幾

{% hint style="warning" %}
注意：如果星期幾出現英文，記得到「檔案 > <mark style="color:red;">**試算表設定**</mark>」中更改<mark style="color:red;">**語言**</mark>。
{% endhint %}

{% tabs %}
{% tab title="📗 參考" %}

* [Google 試算表好用函式：weekday() 根據日期自動產生星期幾](https://smarter01.com/function-weekday/) - 文中雖然介紹要用 WEEKDAY 函數，但只要直接對日期使用文中介紹的「格式 > 數值 > 其他格式 > 更多日期和時間格式」就可以了。
* [Google Sheets Functions – NOW, TODAY, DAY, MONTH, YEAR](https://www.bazroberts.com/2016/11/14/google-sheets-functions-now-today-day-month-year/) - 今年：<mark style="color:red;">**YEAR(TODAY())**</mark>&#x20;
  {% endtab %}

{% tab title="📘 手冊" %}

* Google Help ⟩&#x20;
  * [WEEKDAY](https://support.google.com/docs/answer/3092985?hl=en)
  * [YEAR](https://support.google.com/docs/answer/3093061?hl=en)
  * [Format numbers in a spreadsheet](https://support.google.com/docs/answer/56470)
    {% endtab %}
    {% endtabs %}

## custom function

```javascript
/**
 * 將 0 ~ 6 轉為 "星期一" ～ "星期日"
 * 用 =weekdayName(WEEKDAY(date, 3)) 來轉換
 * @customfuction
 */
function weekdayName(n) {
  const a = ["一", "二", "三", "四", "五", "六", "日"];
  return '星期' + a[n];
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lochiwei.gitbook.io/web/appendix/gas/tips/xian-shi-zhong-wen-xing-qi-ji.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
