sql - Is there any way to get only "-04" or the difference value based on whatever time zone is added in a query? -


is there way "-04" or difference value based on whatever time zone added in query?

select convert(datetime,getdate()) @ time zone 'eastern standard time'     result: 2017-09-12 17:49:18.377 -04:00 

if using sql server can 1 of 2 ways depending on data want

datepart(tz,sysdatetimeoffset()) or datename(tz,sysdatetimeoffset()).

if take @ these functions notice require offsets. getdate() not return correct type. have use sysdatetimeoffset() instead.

for more information on please read this


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -