one way if you are using datetimes
run this in a window
declare @date varchar(100)
select @date = '2009-06-26 14:30:00.000'
select dateadd(hh,datediff(hh,getdate(),getutcdate()),@date)
output
2009-06-26 18:30:00.000
better to just use getutcdate() all the time and store the users offset in his profile
SQL Server 2008 has new datetimeoffset data type which makes this much easier
now here is an answer that will work with the data you have (I added the 1/2 hour code also)
How the code works is explained here: Adding time offsets passed in to a datetime to generate localized datetime
declare @date varchar(100),@multiplier int
select @date = '2009-06-26 14:30:00.000Z+4:30'
select @multiplier = case when @date like '%+%' then -1 else 1 end
select dateadd(mi, @multiplier *convert(int,right(@date,2)),dateadd(hh
,-1 * convert(int,replace(substring(@date,patindex('%z%',@date)+ 1,3),':',''))
,left(@date,23)))
go
--2009-06-26 10:00:00.000
declare @date varchar(100),@multiplier int
select @date = '2009-06-26 14:30:00.000Z-4:30'
select @multiplier = case when @date like '%+%' then -1 else 1 end
select dateadd(mi, @multiplier *convert(int,right(@date,2)),dateadd(hh
,-1 * convert(int,replace(substring(@date,patindex('%z%',@date)+ 1,3),':',''))
,left(@date,23)))
go
--2009-06-26 19:00:00.000
declare @date varchar(100),@multiplier int
select @date = '2009-06-26 14:30:00.000Z+14:30'
select @multiplier = case when @date like '%+%' then -1 else 1 end
select dateadd(mi, @multiplier *convert(int,right(@date,2)),dateadd(hh
,-1 * convert(int,replace(substring(@date,patindex('%z%',@date)+ 1,3),':',''))
,left(@date,23)))
go
--2009-06-26 01:00:00.000
declare @date varchar(100),@multiplier int
select @date = '2009-06-26 14:30:00.000Z-14:30'
select @multiplier = case when @date like '%+%' then -1 else 1 end
select dateadd(mi, @multiplier *convert(int,right(@date,2)),dateadd(hh
,-1 * convert(int,replace(substring(@date,patindex('%z%',@date)+ 1,3),':',''))
,left(@date,23)))
go
--2009-06-27 05:00:00.000