Get the timeZone of the connected user

Rosy Salameh August 13, 2014

Hi Guys,

How to get the timezone of the Connected User? In fact, I'm getting the value of the Date/Time CustomField related to the timeZone of the Server, what I need is the value related to the timezone of the connected user. Could you please help?

For more details, kindly, check my last comment in https://answers.atlassian.com/questions/324977/get-datetime-customfield-value?page=1#comment-325305

Thanks,

Rosy

4 answers

0 votes
Rosy Salameh June 11, 2015

Hello Sreenivas P, No I didn't find it. If you check my latest comment here, you will see how I resolved it! :) Regards, Rosy

0 votes
Sreenivasaraju P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2015

Hi Rosy, Did you get t api to get Date/Time field value related to the timezone of the connected user. If yes, can you please share it.

0 votes
Rosy Salameh August 14, 2014

Thanks Alexey for the tip :) !

I got it using the following code:

ExtendedPreferences extPref = userPreferencesManager.getExtendedPreferences(authenticationContext.getUser());

log.debug("timeZone: " + extPref.getString(PreferenceKeys.USER_TIMEZONE));

Many thanks,

Rosy

Tyler April 26, 2021

For anyone looking this up as I was. Use the

authenticationContext.getLoggedInUser()

instead of 

authenticationContext.getUser()
0 votes
Alexey_Rjeutski__Polontech_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2014

I cannot give you absolutely correct answer, but most possible, you should get user using

https://docs.atlassian.com/jira/6.2.1/com/atlassian/jira/user/util/UserUtil.html

and then either check the user property or user preference (I have idea that it is the second)

https://docs.atlassian.com/jira/6.2.7/com/atlassian/jira/user/UserPropertyManager.html

https://docs.atlassian.com/jira/6.2.7/com/atlassian/jira/user/preferences/UserPreferencesManager.html

Suggest an answer

Log in or Sign up to answer