Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get Timezone for current logged user in Jira

I am trying to fetch the logged in user timezone as below

TimeZoneManager.getLoggedInUserTimeZone() , but it is throwing below error

No signature of method: static com.atlassian.jira.timezone.TimeZoneManager.getLoggedInUserTimeZone() is applicable for argument types: () values: []

Does anyone have idea on resolving this

1 answer

Hi Vineela,

Seems like the TimeZoneManager does not have a static method like that. You should get an instance of the TimeZoneManager, something like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.timezone.TimeZoneManager
import com.atlassian.jira.user.ApplicationUser

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
TimeZoneManager timeZoneManager = ComponentAccessor.getComponent(TimeZoneManager.class)

return timeZoneManager.getTimeZoneforUser(user)

 

Let me know if this works!

 

Jeroen 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

931 views 2 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you