Skip to end of metadata
Go to start of metadata

If your Jenkins instance is running in a different location than the user's (for example: the server is in NY but users are in LA), then the NY time zone will most probably be used, which may be quite annoying if you need to compare build dates.

To see the time zone used go to http://server/systemInfo and see the user.timezone system property.

If you cannot change the time zone of your server, then you can force jelly to use a given time zone for formatting time stamps.

So, you need to start your servlet engine with the following java system property :

java -Dorg.apache.commons.jelly.tags.fmt.timeZone=TZ ...

where TZ is a java.util.TimeZone ID ("Europe/Paris" for example).

Note that

user.timezone=Europe/Paris

will work as well, but it can interfer with other contexts.

If running Jenkins via a system package, this can be accomplished by setting JAVA_ARGS in your /etc/default/jenkins (Debian)

JAVA_ARGS="-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York"

or /etc/sysconfig/jenkins (Red Hat) such as:

JENKINS_JAVA_OPTIONS="-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/New_York"

or, if that doesn't work,

JENKINS_JAVA_OPTIONS="-Duser.timezone=America/New_York"

(note that underscores in timezone names are important) and then restarting Jenkins via the init script (not via the UI).

On FreeBSD, the file to edit is /etc/rc.conf, and the option to use is:

    jenkins_java_opts="-Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Indiana/Indianapolis"

On windows, edit %INSTALL_PATH%/jenkins/jenkins.xml. Note, put "-Dargs" before "-jar".

<arguments>-Xrs -Xmx256m -Duser.timezone="Europe/Minsk" -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080</arguments>

From the Jenkins Script Console on a live system without the need for a restart which can also be included in a Post-initialization script to make it permanent.

System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'America/New_York')
  • No labels

13 Comments

  1. Unknown User (bradley.wagner)

    So, I'm running into a strange problem where my server is set to the correct time and timezone EDT (GMT-4:00) but for some reason the Hudson timezone property is set to GMT-05:00 and the hudson times are all 1 hour off. Is this some inability for Hudson to handle daylight savings time in the US?

  2. timezone set to GMT-8 which is usually right, but currently it's one hour off... kind of confusing/annoying.

  3. But how can we customize other settings like: datetime format, showing GMT in ui, custom timezone for each user?

  4. I was trying to update this on an Ubuntu EC2 Server and found that I needed to change the file /etc/timezone to update Jenkins' time (not /etc/localtime, which I tried first, and it wasn't working).  Apparently that is the official timezone file for for the Ubuntu distro.

    (see http://www.thegeekstuff.com/2010/09/change-timezone-in-linux/)

  5. And one hour off is present by now. Has anyone found out how to solve this problem?

  6. Something I would love to see is to have user timezone applied. We have team members in multiple countries and they often get confused by the time displayed on the Jenkins UI. Many websites check the user's browser data to set the clock 'locally'.

  7. I have users in Delhi, London and Chicago, -D set-the-timezone-for-everyone doesn't do it for me.

    I'd like a user preference such that pages can be displayed in a logged-in users' own local timezone.

  8. I've yet to spend less than 30 frustrating minutes setting up the timezone on a new Jenkins installation. Please, please, please make this a Jenkins setting rather than a depends-on-your-os-and-moon-phase hack.

  9. Core: Jenkins ver. 1.596.2

    We have a instance where in the system time is set to local timezone, but the jenkins is displaying the timestamps in UTC. Checking the systemInfo clearly shows that the Jenkins is using system time

    http://server/systemInfo 

    user.timezone

    Europe/Stockholm

    OS system time.

    root@<hostname>]# date
    
    Wed Jun 22 22:11:22 CEST 2016
    
    root@<hostname>]#  date -u
    
    Wed Jun 22 20:11:24 UTC 2016
    

    Jenkins is displaying this UTC timestamps in all builds..and top page..

  10. Distributed groups are the norm. My team is on opposite sides of the planet. User-defined time zones are critical for what Jenkins does.

  11. I am on ubuntu16, the timezone for Jenkins is incorrectly set to one-hour-earlier as some other comments here mention.  I tried to set the jenkins timezone to America/Los_Angeles via quite a few variants of the original post, and found that one of two results occurred:

    • Nothing happened
    • The timezone was set to GMT

    The suggestion for using the Java Script Console was helpful, I tried putting America/Los_Angeles in there and ! it didn't work either.  But GMT-7 did.  So ... I added GMT-7 to the setting and left a comment in the file so that we can change it back again when the the times change again.  I also tried setting /etc/timezone, /etc/localtime, no effect.  This sounds like a bug to me.

  12. Script Console solution worked for me except for the Next Executions plug-in where timezone had to be simply hard-coded in the custom display format.