Setting the time zone

Updated: April 19, 2023

On the command line, you can set the time zone by setting the TZ environment variable or the _CS_TIMEZONE configuration string.

Note: If TZ isn't set, the system uses the value of the _CS_TIMEZONE configuration string instead. The POSIX standards include the TZ environment variable; _CS_TIMEZONE is a QNX Neutrino implementation. The description below applies to both.

Various time functions use the time-zone information to compute times relative to Coordinated Universal Time (UTC), formerly known as Greenwich Mean Time (GMT). You usually set the time on your computer to UTC. Use the date command if the time isn't automatically maintained by the computer hardware.

You can set the TZ environment variable by using the env utility or the export shell command. You can use setconf to set _CS_TIMEZONE. For example:

env TZ=PST8PDT
export TZ=PST8PDT
setconf _CS_TIMEZONE PST8PDT

The TZ environment variable or _CS_TIMEZONE string can be in POSIX or zoneinfo format: