MySQL uses what is known as a proleptic Gregorian calendar.MySQL使用的是公历。
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.要了解这是如何工作的,请考虑1582年10月,第一次儒略历到公历的转换发生。
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 |
There are no dates between October 4 and October 15. 10月4日和10月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.割接前的日期都是儒略历,割接后的日期都是公历。割接期间的日期不存在。
A calendar applied to dates when it was not actually in use is called proleptic. 应用于实际未使用日期的日历称为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. 这是MySQL所使用的,正如标准SQL所要求的那样。For this reason, dates prior to the cutover stored as MySQL 因此,必须调整存储为MySQL DATE
or DATETIME
values must be adjusted to compensate for the difference. DATE
或DATETIME
值的切换之前的日期,以补偿差异。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. 例如,在英国,它发生在1752年,9月2日星期三之后是9月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.直到1918年,俄罗斯仍然使用儒勒历法,在这一过程中损失了13天,根据公历,人们通常所说的“十月革命”发生在11月。