> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/appendixes/datetime-appendix/datetime-units-history.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# B.6. 單位的歷史 \#

### B.6. 單位的歷史 [#](#datetime-units-history) <a href="#datetime-units-history" id="datetime-units-history"></a>

SQL 標準規定：「在『日期時間字面值』（datetime literal） 的定義中，『日期時間值』（datetime values）受到格里曆中日期與 時間的自然規則所限制」。 PostgreSQL 遵循 SQL 標準的做法，一律以格里曆計算日期， 即使是在該曆法開始使用之前的年份也是如此。 此規則稱為*外推格里曆*（proleptic Gregorian calendar）。

儒略曆由尤利烏斯·凱撒於西元前 45 年制定。 在西方世界中，它一直普遍使用 到 1582 年，那一年各國開始改用格里曆。 在儒略曆中，回歸年的長度 近似為 365 1/4 天 = 365.25 天。這會造成 每 128 年約 1 天的誤差。

日益累積的曆法誤差促使 教宗額我略十三世依照 特利騰大公會議的指示改革曆法。 在格里曆中，回歸年的長度近似為 365 + 97 / 400 天 = 365.2425 天。因此，回歸年 大約需要 3300 年，才會相對於 格里曆偏移一天。

365+97/400 這個近似值是藉由每 400 年 設置 97 個閏年達成的，規則如下：

| 每個可被 4 整除的年份都是閏年。        |
| ------------------------ |
| 然而，每個可被 100 整除的年份都不是閏年。  |
| 然而，每個可被 400 整除的年份終究還是閏年。 |

因此，1700、1800、1900、2100 與 2200 年都不是閏年。但 1600、 2000 與 2400 年是閏年。 相較之下，在較早的儒略曆中，所有可被 4 整除的年份都是 閏年。

1582 年 2 月的教宗詔書頒令自 1582 年 10 月刪去 10 天，使 10 月 15 日緊接在 10 月 4 日之後。 義大利、波蘭、葡萄牙與西班牙遵行了此規定。其他天主教 國家隨後不久也跟進，但新教國家 不願改變，而希臘正教國家直到 20 世紀初才改變。 大不列顛及其屬地（包括現今的 美國）於 1752 年遵行此改革。 因此，1752 年 9 月 2 日的下一天是 1752 年 9 月 14 日。 這就是為什麼具有 `cal` 程式的 Unix 系統 會產生下列結果：

```

$ cal 9 1752
   September 1752
 S  M Tu  W Th  F  S
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
```

不過，當然，此日曆只對大不列顛及其 屬地有效，對其他地方並不適用。 由於要追蹤各地在不同時期實際使用的 曆法既困難又容易混淆， PostgreSQL 並不嘗試這麼做，而是對所有日期 都遵循格里曆規則，即使此方法在歷史上 並不精確。

世界各地發展出了不同的曆法， 其中許多早於格里曆系統。 例如， 中國曆法的起源可以追溯到西元前 14 世紀。傳說黃帝於西元前 2637 年 發明了該曆法。 中華人民共和國在民用上使用格里曆。 中國曆法則用於決定 節日。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/datetime-units-history.html)（原文版本：18.6；核對日期：2026-10-22）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/appendixes/datetime-appendix/datetime-units-history.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
