When running Jenkins CI on Debian Squeeze, you might notice that the system displays UTC time despite your machine being configured for local time (e.g., 'America/Toronto'). This happens because Jenkins defaults to the Etc/UTC
timezone, ignoring system settings.
First, check your system's current timezone configuration:
$ date Mon Jul 9 16:00:57 EDT 2012 $ cat /etc/timezone America/Toronto
Jenkins inherits its timezone from the JVM environment. Even with UTC=no
in /etc/default/rcS
, Jenkins may still use UTC. Check Jenkins' system information:
System.getProperty("user.timezone") = Etc/UTC
There are two reliable methods to make Jenkins use local time:
Method 1: Java System Property
Edit Jenkins' startup configuration (usually in /etc/default/jenkins
):
JAVA_ARGS="-Duser.timezone=America/Toronto"
Then restart Jenkins:
sudo service jenkins restart
Method 2: Global Environment Variable
Alternatively, set the timezone globally for all Java applications:
echo "export TZ=America/Toronto" | sudo tee -a /etc/profile source /etc/profile sudo service jenkins restart
After applying either solution, verify the change:
$ curl -s http://localhost:8080/systemInfo | grep timezone user.timezone = America/Toronto
- Ensure your Debian system has the correct timezone package:
sudo apt-get install tzdata
- Check for multiple timezone configurations in
/etc/timezone
,/etc/localtime
, and/etc/sysconfig/clock
- For Docker-based Jenkins installations, you'll need to set the timezone in both the container and Jenkins configuration
For more flexibility, consider installing the Timezone Plugin:
Manage Jenkins → Manage Plugins → Available → Search for "Timezone"
Then configure it in Manage Jenkins → Configure System
.
When running Jenkins on Debian systems, you might notice that timestamps in build logs and system information show UTC time despite your server being configured with a local timezone. This happens because Jenkins defaults to UTC for consistency across distributed builds.
First, confirm your system's timezone settings:
$ date Mon Jul 9 16:00:57 EDT 2012 $ cat /etc/timezone America/Toronto
The /etc/default/rcS
setting (UTC=no
) only affects how the hardware clock is interpreted during boot - it doesn't control Java applications like Jenkins.
There are several approaches to make Jenkins honor your local timezone:
1. Java System Property
Modify Jenkins startup parameters by editing the init script (usually /etc/default/jenkins
):
JAVA_ARGS="-Duser.timezone=America/Toronto"
Restart Jenkins after making changes:
$ sudo systemctl restart jenkins
2. Global Jenkins Configuration
Alternatively, set the timezone through Jenkins' system configuration:
- Go to Manage Jenkins → System Configuration
- Add a global environment variable:
TZ=America/Toronto
3. Containerized Environments
For Docker installations, pass the timezone through environment variables:
docker run -e TZ=America/Toronto -p 8080:8080 jenkins/jenkins
Check the system information page in Jenkins (/systemInfo
) to confirm:
user.timezone America/Toronto
- If using Tomcat, set the timezone in
setenv.sh
- For systemd services, add
Environment=TZ=America/Toronto
to the service file - Remember that build timestamps in archive files will still use UTC for consistency
Consider installing the Timezone Plugin for per-user timezone preferences:
$ jenkins-plugin-cli --plugins timezone