Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2009-02-05 : 01:13:30
|
| DateTime fields stored in our DB are in UTC. The problem is that when reports are run I need to convert the displayed time to current TimeZone and Daylight savings for the respective PC. Does anyone have a function to do this effectively. I found some functions they claim to have issues during the daylight saving hour etc. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2009-02-05 : 02:00:23
|
| This function looks like it only works with United States or some hard coded place? I dont know the country of installation so it needs to read the time zone from the PC. For example if on my PC (the sql server) the time was UTC 12:00pm as stored in a field and I did a query from Adelaide, Australia then the time would be 21:30 for display. |
 |
|
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2009-02-05 : 02:16:59
|
| This link here looks promising however the stored proc and udf are missing, only the C# code is present. Anyone used this and have all the code?http://channel9.msdn.com/playground/Sandbox/139123/ |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2009-02-05 : 18:28:24
|
| I am using this now and it seems to work well. Thanks tkizer for your help and the credit for this one goes to Mike Dimmick and William Stacey [MVP] for the end solution.http://channel9.msdn.com/playground/Sandbox/139123/My mistake all the code is there just need to install the assembly and set permissions. Code supports:UTC to Local.Local to UTC.Any time to Any Time.Supports Windows DST tables so no need to worry about that nasty daylight savings. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|