且构网

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

如何在SQL Server 2005中存储时区

更新时间:2023-02-07 15:11:01

时区是棘手的,邪恶的东西。它们通常存储为UTC偏移量,但即使在夏令时更改(如果有的话)时也会出现问题。

Timezones are tricky, evil things. They're normally stored as a UTC offset, but even that has issues with regards to things like when daylight savings times change over (if at all).

重新使用Sql Server 2008,您可以使用 datetimeoffset 类型,其中包含具有该值的utc偏移量。否则你需要两列。

If you're using Sql Server 2008, you can use a datetimeoffset type, which includes the utc offset with the value. Otherwise you'll need two columns.