Solved

Local time in DevExpress Report

  • 3 December 2020
  • 2 replies
  • 199 views

Userlevel 5
Badge +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.

icon

Best answer by René W 11 December 2020, 09:01

View original

This topic has been closed for comments

2 replies

Userlevel 2
Badge +1

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

Userlevel 5
Badge +15

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