UTC Date to Local Date

Stimulsoft Reports.NET discussion
Post Reply
kcalexander71
Posts: 2
Joined: Wed Feb 13, 2013 3:20 am

UTC Date to Local Date

Post by kcalexander71 »

Dates are stored in the database as UTC. How do I render them in the report as Local Date?

Thanks.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: UTC Date to Local Date

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

{TimeZoneInfo.ConvertTimeFromUtc(DataSource.ColumnName, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")).ToLocalTime()}
Please check the following link:
http://stackoverflow.com/questions/2580 ... n-database

Thank you.
kcalexander71
Posts: 2
Joined: Wed Feb 13, 2013 3:20 am

Re: UTC Date to Local Date

Post by kcalexander71 »

Yes, that works after adding reference to System.Core.Dll to the Report. Thanks for your help.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: UTC Date to Local Date

Post by Alex K. »

Hello,

We are always glad to help you!

Thank you.
Post Reply