I have seen one question in many forums about asking how to convert local DateTime to UTC DateTime? This is really very simple task to done. All you need to do is, get difference between your local datetime and UTC datetime. GetDate() function will you, your local DateTime and for UTC DateTime, you can use getUTCdate() function. Simply find the difference between these two DateTime in Minutes or in Hours and Add/Deduct that Minutes/Hours from your local datetime and you are done. Let us see how easily we can do it
select DATEADD(hh,datediff(hh,GETDATE(),getUTCdate()),GETDATE()) as ‘UTC DateTime’, GETDATE() as ‘Local DateTime’
–or you can pass your own dateTime field or variable like this.
declare @dt datetime
set @dt=‘9/22/2009 1:25:00 PM’
select DATEADD(hh,datediff(hh,GETDATE(),getUTCdate()),@dt) as ‘UTC DateTime’