且构网

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

在 SQL Server 2008 R2 中获取时区

更新时间:2023-02-06 18:10:34

在 SQL Server 2008 中使用时区数据
http://blogs.msdn.com/b/sqlprogrammability/archive/2008/03/18/using-time-zone-data-in-sql-server-2008.aspx.

如果我对博客条目的理解正确,SQL Server 2008 R2 中没有时区列表,因为这样的列表没有国际公认的标准.相反,Microsoft 提供了 datetimeoffset 数据类型,它允许您使用数字时区偏移.

If I understand the blog entry correctly, there is no time zones list in SQL Server 2008 R2, because there is no internationally recognized standard for such a list. Instead, Microsoft offers a datetimeoffset data type, which allows you to work with numeric time zone offsets.

但是,本文确实提供了一些用于构建您自己的时区列表的试探性解决方案.特别是,它提供了一个示例程序,该程序使用 .NET 库将 Olson Timezone 数据库 (http://www.twinsun.com/tz/tz-link.htm) 中的数据写入表中,然后可以将其导入进入 SQL Server.

However, the article does offer some tentative solutions for building your own time zone list. In particular, it offers an example program that uses a .NET library to write data from the Olson Timezone database (http://www.twinsun.com/tz/tz-link.htm) into a table, which can then be imported into SQL Server.