How do you convert a UTC DateTime to our local DateTime in the ReportBuilder within Visual Studio?

Rookie 0 Reputation points
2025-12-01T22:25:05.6266667+00:00

Our database stores date times in UTC. Our users want to see these in our local time zone (US Pacific). I've tried a variety of suggestions from the internet, and nothing has worked. I am new to both MS Report Builder and Visual Studio (we use MS Report builder within VS to build reports), and while I am sure MS has some tutorials, they are not written for a person new to the technology (to understand MS's tutorials, you have to be an expert developer within the product!).

Can anyone help me?

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
0 comments No comments
{count} votes

Answer recommended by moderator
  1. Michael Le (WICLOUD CORPORATION) 5,765 Reputation points Microsoft External Staff Moderator
    2025-12-02T08:38:19.04+00:00

    Hello @Rookie ,

    To display your UTC dates in Pacific Standard Time, you can use the System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId method directly in your expression.

    This approach also automatically handles Daylight Saving Time adjustments for you, so you do not need to manually calculate offsets.

    You can use the following expression in your report field (remember to replace UtcEventTime with your actual field):

    =System.TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Fields!UtcEventTime.Value, "UTC", "Pacific Standard Time")
    

    User's image

    User's image

    I hope this helps.

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-01T22:25:13.3933333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    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:

    1. Create a calculated field in your dataset where you want to display the local time.
    2. 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:


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.