Does any one know how can I convert datetime to UTC in sql?
Example: If I have a datetime variable @test = '2014-09-09 9:00:00', how can I convert @test into UTC in SQL?
Does any one know how can I convert datetime to UTC in sql?
Example: If I have a datetime variable @test = '2014-09-09 9:00:00', how can I convert @test into UTC in SQL?
Please try below Query in SQL Server :
Declare @test as datetime
set @test = '2014-09-09 9:00:00'
SELECT DATEADD(second, DATEDIFF(second, GETDATE(), GETUTCDATE()), @test)