Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Abstract

This code snippet fetches the current user's time zone.

...

Code Block
languagegroovy
linenumberstrue
import com.atlassian.jira.timezone.TimeZoneManager

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

Placeholders

N/A

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.

Code Block
languagegroovy
linenumberstrue
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")

...

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in (= "jmwe-groovy"," jmwe-server") and type = "page" and space = "JMWE"
labelsjmwe-nunjucks jmwe-cloud

...