On SQL Server 2008 R2, I have following T-SQL code:
SELECT CAST(GETDATE() AS DATETIMEOFFSET);
This gives me the result as below:
2011-12-26 10:21:13.7970000 +00:00
But the result is what I wanted to be. It should be this:
2011-12-26 10:21:13.7970000 +02:00
Here is my machine's Date and Time Settings:
The same thing happens while I am inserting a value:
DECLARE @foo AS TABLE(
fooDate DATETIMEOFFSET
);
INSERT @foo VALUES(GETDATE());
SELECT * FROM @foo;
This gets me the same wrong result (at least wrong for my needs).
What am I missing here?
Try this
SELECT SYSDATETIMEOFFSET();
GETDATE()
function has no any timezone information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With