Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the time zone in Jenkins?

I wish to change the time zone of the Jenkins.

I have changed the time zone of the Jenkins installed server, but the Jenkins UI shows the different time.

I need to set the PST time for Jenkins UI. How can I do it?

like image 553
soundararajan.c Avatar asked Feb 13 '17 10:02

soundararajan.c


People also ask

How do I change timezone in Jenkins?

To see the time zone currently set, go to jenkins_server/systemInfo and see the user. timezone system property. You may want to change the time zone displayed to match your own time zone. By going to your user configuration page, you can set the User Defined Time Zone to match your own.

How do I set the timezone in Java?

You can explicitly set a default time zone on the command line by using the Java system property called user. timezone . This bypasses the settings in the Windows operating system and can be a workaround.


3 Answers

On Jenkins2 you can set the timezone at runtime via the Groovy Console. Just open "Manage Jenkins >> Script Console" and type

System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/Los_Angeles')

for example. Particularly helpful if you have no chance to change the startup variables but have admin rights on the instance. (often found in containerized setups). Only downside: Setting is gone on restart.

like image 146
Ben Steinert Avatar answered Oct 24 '22 09:10

Ben Steinert


See https://wiki.jenkins-ci.org/display/JENKINS/Change+time+zone. Jenkins should respect the timezone set for java. But you can force Jenkins to use a specific timezone by adding the following to start command of Jenkins:

java -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Los_Angeles

This should set your timezone to PST.

like image 41
Jon S Avatar answered Oct 24 '22 09:10

Jon S


Login to jenkins and goto right top end and click on the user

then click on the configure and scroll down to last option "User Defined Time Zone" here you can find the different timezones.

I am using jenkins version 2.222.3.

like image 12
nikhil Avatar answered Oct 24 '22 10:10

nikhil