且构网

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

如何在 SQL Server 中将 bigint(UNIX 时间戳)转换为日期时间?

更新时间:2023-01-22 11:45:12

这对我有用:

Select
    dateadd(S, [unixtime], '1970-01-01')
From [Table]

如果有人想知道为什么 1970-01-01,这被称为 ***时间.

In case any one wonders why 1970-01-01, This is called Epoch time.

以下是***的引述:

Below is a quote from Wikipedia:

自 1970 年 1 月 1 日星期四 00:00:00 协调世界时 (UTC) 起经过的秒数,[1][注 1] 不计算闰秒.

The number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970,[1][note 1] not counting leap seconds.