Jenkins “Build Triggers” shows UTC instead of local or server timezone

Jenkins

When configuring jobs to run periodically, Jenkins is showing UTC time. I expect Jenkins to show the timezone as America/New_York.

Build Triggers shows UTC timezone

Jenkins version 2.121.2 is configured to run using timezone America/New_York as described in this article https://wiki.jenkins.io/display/JENKINS/Change+time+zone

I've confirmed this by looking at the java process and I can see the option passed

jenkins    1706  7.1 79.5 16210100 12923272 ?   Ssl  May11 8541:26 /etc/alternatives/java -XX:+UseG1GC -Xms1g -Xmx12g -XX:MaxMetaspaceSize=512m -Dhudson.tasks.MailSender.SEND_TO_UNKNOWN_USERS=true -Djava.awt.headless=true -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York -DJENKINS_HOME=/var/lib/jenkins -jar -Dcb.distributable.name=RedHat / Fedora RPM -Dcb.distributable.commit_sha=888f01a54c12cfae5c66ec27fd4f2a7346097997 /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --httpListenAddress=127.0.0.1 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

I can also see the option in http://server/systemInfo
java option systeminfo

And the user.timezone is also set to America/New_York
enter image description here

The server is configured to use America/New_York timezone as well:

# ls -lAF /etc/localtime
lrwxrwxrwx. 1 root root 38 Jan  7  2018 /etc/localtime -> ../usr/share/zoneinfo/America/New_York

# date
Thu Aug  2 15:01:36 EDT 2018

idk if it matters, but Jenkins is using OpenJDK:

/etc/alternatives/java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

I expect that the 'Schedule' box would show the server timezone or my timezone, not UTC.

Best Answer

I got this working finally by setting BOTH (it didnt work without the user one):

  • -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York
  • -Duser.timezone=America/New_York

Since I run in Docker, my full command line (maybe useful to someone) is here:

docker run --name=jenkins -td -p 5000:5000 -p 80:8080 -v $HOME/jenkins_home:/var/jenkins_home -e "JAVA_OPTS=-server -XX:+AlwaysPreTouch -Xloggc:\$JENKINS_HOME/gc-%t.log -XX:NumberOfGCLogFiles=5 -XX:+UseGCLogFileRotation -XX:GCLogFileSize=20m -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCCause -XX:+PrintTenuringDistribution -XX:+PrintReferenceGC -XX:+PrintAdaptiveSizePolicy -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1 -Xms5120m -Xmx10240m -Dhudson.model.ParametersAction.keepUndefinedParameters=true -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York -Duser.timezone=America/New_York" jenkins/jenkins:2.164.3

This takes into some performance tuning stuff found at https://jenkins.io/blog/2016/11/21/gc-tuning/