且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL 如何将数字(整数)转换为日期?

更新时间:2023-11-29 13:20:34

基于 1900 年 1 月 1 日的 SQL Server 纪元(基准或零日期),这些日期在 22 世纪

Based on the SQL Server epoch (base or zero date) of 01 Jan 1900, these dates are in 22nd century

SELECT DATEADD(day, 75739, 0) -- 2107-05-15 00:00:00.000

还是基于日期时间的下限?这是 1960-ish,适用于出生日期

Or are they based on the lower bound of datetime? This is 1960-ish, which works for date of births

SELECT DATEADD(day, 75739, '17530101') -- 1960-05-15 00:00:00.000

tl;dr 需要更多信息.否则不要尝试

tl;dr more info needed. Otherwise don't even try