I am trying to use the new DATETIMEOFFSET data type in SQL 2008 but I can't figure out how to get the DATETIMEOFFSET '2008-09-27 21:28:17.2930000 -07:00' to show as '2008-09-27 14:28:17.2930000' (basically applying the offset to show the local time).
我试图在SQL 2008中使用新的DATETIMEOFFSET数据类型,但我无法弄清楚如何获得DATETIMEOFFSET'2008-09-27 21:28:17.2930000 -07:00'显示为'2008-09-27 14:28:17.2930000'(基本上应用偏移量来显示当地时间)。
Does anyone know how to do this?
有谁知道如何做到这一点?
1 个解决方案
#1
1
The following MSDN articles appear to cover this:
以下MSDN文章似乎涵盖了这一点:
- http://msdn.microsoft.com/en-us/library/bb384267.aspx
- http://msdn.microsoft.com/en-us/library/bb630289.aspx
- http://msdn.microsoft.com/en-us/library/ms187928.aspx
It appears that you need to cast the datetimeoffset into another format, such as datetime, but the sample code on the 'CAST and CONVERT' page is not clear on that.
您似乎需要将datetimeoffset转换为另一种格式,例如datetime,但“CAST和CONVERT”页面上的示例代码并不清楚。
#1
1
The following MSDN articles appear to cover this:
以下MSDN文章似乎涵盖了这一点:
- http://msdn.microsoft.com/en-us/library/bb384267.aspx
- http://msdn.microsoft.com/en-us/library/bb630289.aspx
- http://msdn.microsoft.com/en-us/library/ms187928.aspx
It appears that you need to cast the datetimeoffset into another format, such as datetime, but the sample code on the 'CAST and CONVERT' page is not clear on that.
您似乎需要将datetimeoffset转换为另一种格式,例如datetime,但“CAST和CONVERT”页面上的示例代码并不清楚。