Question

How can I change the Datetime values for the existing data to UTC Time? Is any inbuilt SQL qry available to change?

Eg. Existing Data in the table

CreatedON
2013-03-01 08:12:00.000
2013-03-01 13:15:18.000
2013-03-01 13:10:00.000

Need to convert this data to UTC time which is recorded as GMT Time during creation. Any suggestions will be helpful

Was it helpful?

Solution

try this:

declare @a datetime 
set @a='2013-03-01 08:12:00.000'

select  DateAdd(s,DateDiff(s, getdate(),getutcdate()),@a )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top