sql server - Convert a given datetime to UTC time based on time zone description in SQL -


i have data following. first column of type datetime, , second column corresponding time zone info, , of type nvarchar.

 07/04/2012 14:20:45   eastern standard time 07/04/2012 13:55:10   indian standard time 07/04/2012 10:55:00   central standard time 

how can convert datetime column value of rows utc time?

try this

update dbo.yourtable set datetimecolumn=case timeshift                          when n'eastern standard time'                              dateadd(hour,easterntimeshift,datetimecolumn)                         when n'indian standard time'                              dateadd(hour,indiantimeshift,datetimecolumn)                         ...                         else datetimecolumn                     end 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -