Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert UTC to users Local Time

Reading through several posts on date conversion I still am a bit confused.  I am pulling UTC timestamps from a database and using the timestamp as one of my dimensions in a chart.  I would like to have the option of displaying the dimension in the users local time rather than UTC.  I know I can accomplish this with a button object to alter the dimension expression, but just not sure what QV Time function to apply to UTC to get users local time?

4 Replies
Gysbert_Wassenaar

You can use the ConvertToLocalTime function. See the help file for details and examples.


talk is cheap, supply exceeds demand
Not applicable
Author

Yes, aware of that function, but it requires one to enter a specific time zone as a parameter.  What I want is to automatically use the local time zone of the user regardless of where they are geographically -- seems there should be a function to pull time zone from users pc and utilize that as parameter in ConvertToLocalTime? 

Gysbert_Wassenaar

And how would you expect that to work in the ajax client? There's no telling where the user connects from to Qlikview Server. Qlikview has no function for that, probably because it's completely impractical.

If your users are using QV Desktop you can use a macro that runs when the OnOpen document trigger fires and sets a variable by getting the systems timezone. Here's some vbscript code that may be of use.

edit: you can find out the timezone offset by subtracting now() and UTC(): interval(now() - utc(),'h'). No idea what happens in the ajax client though. My guess is it would return the timezone offset of the server, not the client.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

Right    I obviously didn't think this one through completely.  I suppose I can have a select box for setting time zone.

Thanks for your assistance as always.

Regards,

Lew