Reporting Services Tips and Tricks > Time Zone Determination > How do I convert my dates in a report to another time zone?

Search the FAQ for entries containing:

If you ever have had to deal with converting a date to another time zone you will realize that it can be a bit confusing. It can be especially confusing when you consider that a particular report could span a daylight savings time change. Microsoft has made the task of converting from one time zone to another a bit easier with their time zone conversion routines such as System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId. This method can be found here on the Microsoft MSDN site.

An example of how I recently utilized this method recently in one of my reports will be shown here. I first set up a parameter called TimeZone where the user can choose from a list of different time zones as seen below:

If you are simply placing a date on a report you can use the System.TimeZoneInfo method within an expression within a table or a text box. But first you need to add a reference within Report Properties to the System.Core, version 3.5 of the .NET framework by doing the following:

You can then utilize the System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId method in an expression as follows:

When you run the report for Eastern Standard Time you get the following results:

And simply by choosing a different time zone parameter the results for the newly-chosen time zone are seen in the far right column. This time the time zone chosen is Pacific Standard Time.

Time zone calculations may be challenging but the Microsoft methods available with .NET version 3.5 make the task a whole lot easier.

 

 

 

 

Last updated on November 9, 2011 by Bob