To convert a UTC DateTime to your local DateTime in Report Builder, you can use the ToLocalTime method of the DateTime object. This method adjusts the UTC time to the local time based on the system's time zone settings. Here's a basic example of how you can implement this in your report:
- Create a calculated field in your dataset where you want to display the local time.
- Use the following expression to convert the UTC DateTime to local time:
=Fields!MyDateTime.Value.ToLocalTime()
Replace MyDateTime with the actual field name that contains your UTC DateTime.
If you need to specify a particular time zone (like US Pacific Time), you may need to adjust the UTC time manually by using the TimeZoneInfo.ConvertTimeFromUtc method in your code behind or in a custom function, as Report Builder does not directly support specifying time zones in expressions.
For example, if you want to convert UTC to Pacific Time, you can use:
=TimeZoneInfo.ConvertTimeFromUtc(Fields!MyDateTime.Value, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"))
This will ensure that your users see the DateTime values in their local time zone.
References: