问题
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?
回答1:
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.
回答2:
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.
回答3:
While trying to find an answer to this, found that an issue is already open for this.
Though the issue status is OPEN, Unresolved
, I see an option to use the browser time zone at least for the Console Output
time stamps in Jenkins (2.60.2) >> <jobName> >> <build#>
:
回答4:
I am using ubuntu version 16.04 and jenkins version Jenkins ver. 2.164.3 I tried using java -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Los_Angeles but didn't worked for me. then I ended up using this command- sudo dpkg-reconfigure tzdata, this will present you a GUI to set your timezone and then you have to restart jenkins via commands Sudo /etc/init.d/jenkins stop sudo /etc/init.d/jenkins start
Hope this helps! Cheers prateek
回答5:
I went with the system-wide solution:
I have a bitnami image (which defaults to UTC) running on AWS (in us-east-2). All the work this server does is in my local timezone, and all the people who access it are local. So I changed /etc/timezone
and /etc/localtime
to Australia/Sydney and restarted Jenkins.
来源:https://stackoverflow.com/questions/42202070/how-to-change-the-time-zone-in-jenkins