Skip to main content
Solved

Local time in DevExpress Report

  • December 3, 2020
  • 2 replies
  • 236 views

Forum|alt.badge.img+15

We’re using Azure for the webgui and database hosting. If you use the “Current date and time”, it takes the Azure server local time / utc0. Not the client time, which can be in a different time zone.

Is it possible to display the client time in the webgui reports instead of the server time? I prefer to solve this in the DevExpress report if possible.

There is probably a workaround possible using some database functions and storing the users time zone in the database, but that is not preferred.

Best answer by René W

Hi Edo, that's unfortunate. But I’ve posted an idea for this:

https://community.thinkwisesoftware.com/ideas/display-datetime-values-timezone-friendly-1619

For common interest;

We currently have a workaround that stores the time zone in a table using sys.time_zone_info. Then whe use a helper function that does a query like below:

declare @date_time datetime2 = '2020-11-12 07:57:00' -- this value must be UTC0.

select convert(datetime2, @date_time at time zone 'UTC' at time zone 'Hawaiian Standard Time') -- returns 2020-11-11 21:57

select tzi.name 
     , tzi.current_utc_offset
     , convert(datetime2, @date_time at time zone 'UTC' at time zone tzi.name) as local_time
from sys.time_zone_info tzi

 

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Forum|alt.badge.img+1
  • Moderator
  • 89 replies
  • December 10, 2020

Hello René,

You could pass the current time via a hidden parameter to the report.

I can’t think of any other way to fix this other than the workarounds you already mentioned where not preferred.

Edo Spijker


Forum|alt.badge.img+15
  • Author
  • Superhero
  • 196 replies
  • Answer
  • December 11, 2020

Hi Edo, that's unfortunate. But I’ve posted an idea for this:

For common interest;

We currently have a workaround that stores the time zone in a table using sys.time_zone_info. Then whe use a helper function that does a query like below:

declare @date_time datetime2 = '2020-11-12 07:57:00' -- this value must be UTC0.

select convert(datetime2, @date_time at time zone 'UTC' at time zone 'Hawaiian Standard Time') -- returns 2020-11-11 21:57

select tzi.name 
     , tzi.current_utc_offset
     , convert(datetime2, @date_time at time zone 'UTC' at time zone tzi.name) as local_time
from sys.time_zone_info tzi

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings