Showing posts with label DayLightSaving. Show all posts
Showing posts with label DayLightSaving. Show all posts

Monday, 13 April 2015

SQL script to deal with Day Light Savings in SQL server


We have a situation wherein the data from one particular table needs to be displayed in different time-zones. We store the history of one particular SSRS report in this table. This report provides the UI to refresh the data of few tables. It executes one particular procedure in the back-end to do so. The same procedure is scheduled to run on weekly basis using SQL agent as well.
To log last refresh time and the place (agent or report) from where it is done, we created a table in which an entry is made as soon as the procedure is called from either (SQL agent or SSRS report)

Displaying data in different timezone is easy until day light savings rule comes into picture. In order to overcome this I wrote a SQL script so that particular date gets converted to expected timezone.

In the below given script I have tried to display the date in following timezones

  • Melbourne
  • EST
  • PST
  • CST
  • UTC




bloggerwidgets