本文介绍了SQL Server 中 1/1/1753 的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么是 1753?他们对 1752 有什么看法?我的曾曾曾曾曾曾曾祖父会很生气的.

解决方案

决定使用 1753 年 1 月 1 日 (1753-01-01) 作为 SQL Server 中日期时间的最小日期值回到它的 .这立法为英国及其当时的殖民地采用公历.

有一些 1752 年英国历法中的缺失天数 最终从儒略历进行了调整.1752 年 9 月 3 日至 1752 年 9 月 13 日丢失.

Kalen Delaney 解释了这个选择方式

那么,失去了 12 天,你怎么能计算日期?例如,怎么能你计算之间的天数1492 年 10 月 12 日和 1776 年 7 月 4 日?做你包括那些失踪的 12 天?到避免不得不解决这个问题,原始的 Sybase SQL Server开发商决定不允许日期1753 之前.您可以更早地存储使用字符字段的日期,但是你不能使用任何日期时间函数与您存储的较早日期在字符字段中.

1753 年的选择确实看起来有些以英国为中心,但欧洲 许多天主教国家在英国实施之前已经使用日历 170 年(最初由于反对 教会反对).相反,许多国家直到 1918 年在俄罗斯才改革他们的历法.事实上,1917 年的十月革命是在公历的 11 月 7 日开始的.

datetime 和新的 datetime2 数据类型-of-1-1-1753-in-sql-server/3310627#3310627">Joe 的回答不要试图考虑这些地方差异,而只是使用公历.

所以 datetime2

的范围更大

SELECT CONVERT(VARCHAR, DATEADD(DAY,-5,CAST('1752-09-13' AS DATETIME2)),100)

返回

1752 年 9 月 8 日上午 12:00

datetime2 数据类型的最后一点是它使用 proleptic Gregorian日历 倒推到它实际发明之前,因此在处理历史日期方面用途有限.

这与 Java 公历 类默认遵循儒略历直到 1582 年 10 月 4 日,然后在新的公历中跳转到 1582 年 10 月 15 日.它正确处理了该日期之前的闰年儒略模型和该日期之后的公历模型.调用者可以通过调用 setGregorianChange() 更改切换日期.

一篇相当有趣的文章讨论了采用日历的更多特性可以在这里找到.

Why 1753? What do they have against 1752? My great great great great great great great grandfather would be very offended.

解决方案

The decision to use 1st January 1753 (1753-01-01) as the minimum date value for a datetime in SQL Server goes back to its Sybase origins.

The significance of the date itself though can be attributed to this man.

Philip Stanhope, 4th Earl of Chesterfield. Who steered the Calendar (New Style) Act 1750 through the British Parliament. This legislated for the adoption of the Gregorian calendar for Britain and its then colonies.

There were some missing days in the British calendar in 1752 when the adjustment was finally made from the Julian calendar. September 3, 1752 to September 13, 1752 were lost.

Kalen Delaney explained the choice this way

The choice of 1753 does seem somewhat anglocentric however as many catholic countries in Europe had been using the calendar for 170 years before the British implementation (originally delayed due to opposition by the church). Conversely many countries did not reform their calendars until much later, 1918 in Russia. Indeed the October Revolution of 1917 started on 7 November under the Gregorian calendar.

Both datetime and the new datetime2 datatype mentioned in Joe's answer do not attempt to account for these local differences and simply use the Gregorian Calendar.

So with the greater range of datetime2

SELECT CONVERT(VARCHAR, DATEADD(DAY,-5,CAST('1752-09-13' AS DATETIME2)),100)

Returns

Sep  8 1752 12:00AM

One final point with the datetime2 data type is that it uses the proleptic Gregorian calendar projected backwards to well before it was actually invented so is of limited use in dealing with historic dates.

This contrasts with other Software implementations such as the Java Gregorian Calendar class which defaults to following the Julian Calendar for dates until October 4, 1582 then jumping to October 15, 1582 in the new Gregorian calendar. It correctly handles the Julian model of leap year before that date and the Gregorian model after that date. The cutover date may be changed by the caller by calling setGregorianChange().

A fairly entertaining article discussing some more peculiarities with the adoption of the calendar can be found here.

这篇关于SQL Server 中 1/1/1753 的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:41