I am in the process of porting an existing application to run on Windows Azure. Our current solution relies heavily on the time zone Windows is set to on the SQL Server. We use GETDATE() in our stored procedures and views quite frequently. The problem is that SQL Azure running using the UTC time zone. I’m trying to replace the GETDATE() method call with a method call that will get the time based on a setting in the database of what the time zone should be. The problem I’m having is Daylight Saving Time. Has anyone ever written a method in SQL that can return the current Date/Time and properly adjusting for DST?
I’m guessing that I’m going to get a few answers that will say that I should be using UTC times across the board. That does not appear to be an option for reasons I’d rather not explain.
Any help/suggestions you can give me would be greatly appreciated. Thanks.
We have decided to update the columns in question to be
DateTimeOffsetinstead ofDateTime.Thanks to all those who responded.