Get timeZone of the Server

Hello,

Is there a way to get the timeZone of the server where the instance Jira is installed through the code?

Thanks,

Rosy

2 answers

Thanks Alexey.

I got it in a different method (easier one);

I transformed the date/time value of the customField into a Calendar Object and I used the method getTimeZone from that object like this:

Calendar calendarOfDateTimeCustomField = new GregorianCalendar(Integer.valueOf(year),Integer.valueOf(month)-1,Integer.valueOf(day),Integer.valueOf(hour),Integer.valueOf(minute),Integer.valueOf(second));

log.debug("currentServer TimeZone: " + calendarOfDateTimeCustomField.getTimeZone().getRawOffset());

where year, month, hour,... are parsed from customField.getValue(issue).

Thanks anyway for your prompt reactivity,
Rosy

I would not say this method is easier, but, if that works for you - it's fine) Please note that your code should be well commented to explain what are you doing if you plan to support it somehow.

Thanks Alexey for the feedback, well noted, however, I didn't comment it here because I'm just explaining the method that i used instead of getting the timezone of the server (just to inform you that I didn't have the chance to try the method in the link above and get back to you with the result).

Thanks,

Rosy

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,755 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot