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

How to get Timezone for current logged user in Jira

Vineela Durbha January 30, 2019

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

Suggest an answer

Log in or Sign up to answer
1 vote
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2020

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 

TAGS
AUG Leaders

Atlassian Community Events