env.dev

TZ

Sets the timezone for the process, affecting how times are displayed and how time-related functions operate. Uses the IANA Time Zone Database identifiers. When not set, the system timezone from /etc/localtime is used.

Last updated:

TZ sets the timezone for a single process using IANA Time Zone Database names like `America/New_York` or `Europe/London` — never raw offsets like GMT+2, because those ignore daylight saving. It is the cleanest way to make one service run in a specific zone without changing the whole machine: set TZ and the C library's localtime(), plus most language runtimes, immediately honor it. The standard advice still holds — store and compute in UTC, convert at display time — but TZ is what you reach for when a cron job, log timestamp, or report must render in a particular local zone.

Provider
General / OS
Category
locale
Set by
Set via environment variable, system settings, or /etc/timezone
Example
America/New_York
Gotcha: Minimal containers (Alpine especially) ship without the tzdata package, so setting TZ=Europe/Oslo has no effect and times stay UTC until you install tzdata. Also, abbreviations like `EST` are not real IANA zones and do not observe daylight saving — always use Region/City. In Node, changing process.env.TZ after the process starts is unreliable; set it before launch.

How to set TZ

run one command in a zone

TZ=Asia/Tokyo date

Docker (Alpine needs tzdata)

RUN apk add --no-cache tzdata
ENV TZ=Europe/Oslo

docker-compose

services:
  app:
    environment:
      TZ: America/New_York

Frequently Asked Questions

I set TZ but the time is still UTC in my container. Why?

The timezone database is missing. Alpine and other slim images do not include tzdata, so the IANA zone you named cannot be resolved and the process stays on UTC. Install it (`apk add tzdata` / `apt-get install tzdata`) and make sure TZ uses a Region/City name, not an abbreviation like EST.

Was this helpful?

Stay up to date

Get notified about new guides, tools, and cheatsheets.

Browse all 242 environment variables →