Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Abstract

This code snippet fetches the current user time zone.

Logic

Access the Time zone service of Jira and fetch the logged in user time zone

Snippet

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

// access timeZone of current user
def userTimeZone = getComponent(TimeZoneManager).getLoggedInUserTimeZone()

Placeholders

NA

Examples

The outcome of the code snippet is a zoneInfo that you can use to create a calendar instance in the current user time zone.

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

// access timeZone of current user
def userTimeZone = getComponent(TimeZoneManager).getLoggedInUserTimeZone()
c1 = GregorianCalendar.getInstance(userTimeZone);
return c1.format("HH:mm")

References

Filter by label

There are no items with the selected labels at this time.

  • No labels