8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

13.2.7 MySQL 使用哪种日历?13.2.7 What Calendar Is Used By MySQL?

MySQL 使用的是所谓的 前置公历(proleptic Gregorian calendar)。MySQL uses what is known as a proleptic Gregorian calendar.

每个从儒略历改为格里高利历的国家在切换时都必须至少舍弃十天。为了了解这是如何运作的,我们来看 1582 年 10 月,那是首次进行儒略历到格里高利历切换的月份。Every country that has switched from the Julian to the Gregorian calendar has had to discard at least ten days during the switch. To see how this works, consider the month of October 1582, when the first Julian-to-Gregorian switch occurred.

星期一Monday 星期二Tuesday 星期三Wednesday 星期四Thursday 星期五Friday 星期六Saturday 星期日Sunday
1 2 3 4 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

10 月 4 日到 10 月 15 日之间没有日期。这种不连续性称为切换。切换之前的日期是儒略历,切换之后的日期是公历。切换期间的日期不存在。There are no dates between October 4 and October 15. This discontinuity is called the cutover. Any dates before the cutover are Julian, and any dates following the cutover are Gregorian. Dates during a cutover are nonexistent.

当日历被应用到实际上并未使用的日期时,称为溯及。因此,如果我们假设从未进行过过渡,并且始终遵循格里高利规则,那么我们就有一个溯及格里高利历。这就是 MySQL 所使用的日历,也是标准 SQL 所要求的。因此,存储为 MySQL DATE 或 DATETIME 值的过渡前日期必须进行调整以补偿差异。重要的是要意识到,不同国家的日历过渡时间并不相同,而且过渡发生得越晚,丢失的天数就越多。例如,在英国,这一过渡发生在 1752 年,当时 9 月 2 日星期三之后直接跳到 9 月 14 日星期四。俄罗斯一直沿用儒略历直到 1918 年,在此过程中丢失了 13 天,而大众所称的其“十月革命””实际上根据格里高利历发生在 11 月。A calendar applied to dates when it was not actually in use is called proleptic. Thus, if we assume there was never a cutover and Gregorian rules always rule, we have a proleptic Gregorian calendar. This is what is used by MySQL, as is required by standard SQL. For this reason, dates prior to the cutover stored as MySQL DATE or DATETIME values must be adjusted to compensate for the difference. It is important to realize that the cutover did not occur at the same time in all countries, and that the later it happened, the more days were lost. For example, in Great Britain, it took place in 1752, when Wednesday September 2 was followed by Thursday September 14. Russia remained on the Julian calendar until 1918, losing 13 days in the process, and what is popularly referred to as its “October Revolution” occurred in November according to the Gregorian calendar.