New Date/Time data types in SQL 2008
-
02-07-2019 - |
Question
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).
Does anyone know how to do this?
Solution
The following MSDN articles appear to cover this:
- 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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow