Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Timezone for current logged user in Jira

Vineela Durbha
Contributor
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 Champion
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