How can i get TZoffset in T-SQL?
Clash Royale CLAN TAG#URR8PPP
How can i get TZoffset in T-SQL?
I have a following code I want to know on which TZoffset is it? How can I calculate TZoffset? Here the code
SELECT DATENAME(day, '1998-01-08 20:20:30.1234567 +2:00');
After all, this is what I know:
Datepart Return Value
yyyy 1998
quarter 1
month January
dayofyear 08
day 08
week 2
weekday Sunday
hour 20
minutes 20
seconds 30
milliseconds 123
microseconds 1234567
nanoseconds 123456700
TZoffset ?....(?).....? help, how do I get it?.
ISOWW 2
Help me on how to find/calculate TZoffset.
1 Answer
1
I've managed to get it, according to my code:
select datename(day, '1998-01-08 20:20:30.1234567 +2:00')
by using running the following code it will provide you with the correct tzoffset, like this:
select datename(tzoffset, '1998-01-08 20:20:30.1234567 +2:00')
The code returned +2:00 as my tzoffset.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I would have thought the +2:00 should be +02:00. What is the exact SQL statement you are using to get the timezone?
– MandyShaw
Aug 9 at 20:53