SET @DateTimeWithOffset ' 15:30:00 02:00 select @DateTimeWithOffset switchoffset DateTimeWithOffset, '00:00 select @JustDateTime cast DateTimeWithOffset AS datetime).
Else @p1, eND, eND.
Return @dtLocal, eND.
Is you proposed solution daylight-saving-aware please?Note: IF your server IS using native US dates reverse these TWO date parts TO 03/01 and 10/01!So you feed it a UTC date and it'll automatically work out whether an historic date is BST or GMT.Declare @DateTimeWithOffset datetimeoffset, declare @JustDateTime datetime.
I wrote it for British Summer time - which unfortunately occurs on the last Sunday of the months of March and October, making the logic a little convoluted.
Basically the hard coded date part 01/03 is looking for the last Sunday in March and 01/10 is looking for the last Sunday in October (which is when the clocks go forward and back here).
Okay, if the offset in your datetimes is always the same, you can try this transformation.
Solved, posted on, please help me to fill the dots below.
Create function dtUtc2Local dtUtc datetime)returns datetime as -Parameter: UTC datetime -returns: Corresponding local time begin, declare @dtLocal as datetime.I don't have an SQL 2008 right at hand so I haven't tested that.Run this script to create the function and call it inline in your select.Not the best font tcvn3 sample font thing to use on a big data boyaa texas poker hack tool set but it's a solution.(GMT-06:00) Saskatchewan (GMT-06:00) Guadalajara, Mexico City, Monterrey - Old (GMT-06:00) Guadalajara, Mexico City, Monterrey - New (GMT-06:00) Central Time (US Canada) (GMT-06:00) Central America, added: Now I see you asked for something else.The major changes in new SQL Server 2008 are the DateTime function and the introduction of new data types.