You can set the timezone by calling the tzset function. tzset passes the values held in the TZ environment variable to any other function in the library that may require them (for example, mktime).
The TZ environment variable can be set using the set command. For example, the
following command sets the standard time zone to CST, sets the daylight saving time zone
to CDT, and sets a difference of 6 hours between CDT and Coordinated Universal Time (UTC):
SET TZ=CST6CDT
The new value will not take effect until the program is restarted, and tzset is
called.
The set command has the following format:

TZ can also be set at run time, using _putenv. For example:
_putenv("TZ=CST6CDT");
If tzset has not been called, or if tzset is called but the TZ variable is not set, the default values will be used.
The default values (which are also the values for the C locale, the default locale at program startup) are listed in the following table.
| Variable | Description | ||
|---|---|---|---|
| SSS | Standard-timezone identifier. It must be three characters, must begin with a letter, and can contain spaces. Zone names are determined by local or country convention. For example, EST stands for Eastern Standard Time and applies to parts of North America. | " " (three blanks) |
Copied from the registry |
| h, m, s | The variable h specifies the difference (in hours) between the standard time zone and CUT, formerly Greenwich mean time (GMT). You can optionally use m to specify minutes after the hour, and s to specify seconds after the minute. A positive number denotes time zones west of the Greenwich meridian; a negative number denotes time zones east of the Greenwich meridian. The number must be an integer value. | 0 | Copied from the registry |
| DDD | Daylight saving time (DST) zone identifier. It must be three characters, must begin with a letter, and can contain spaces. | " " (three blanks) |
Copied from the registry |
| sm | Starting month (1 to 12) of DST. | 0 | Copied from the registry |
| sw | Starting week (-4 to 4) of DST. Use negative numbers to count back from the last week of the month (-1) and positive numbers to count from the first week (1). | 0 | Copied from the registry |
| sd | Starting day of DST. 0 to 6 if sw != 0 1 to 31 if sw = 0 |
0 | Copied from the registry |
| st | Starting time (in seconds) of DST. | 0 | Copied from the registry |
| em | Ending month (1 to 12) of DST. | 0 | Copied from the registry |
| ew | Ending week (-4 to 4) of DST. Use negative numbers to count back from the last week of the month (-1) and positive numbers to count from the first week (1). | 0 | Copied from the registry |
| ed | Ending day of DST. 0 to 6 if ew != 0 1 to 31 if ew = 0 |
0 | Copied from the registry |
| et | Ending time of DST (in seconds). | 0 | Copied from the registry |
| shift | Amount of time change (in seconds). | 0 | Copied from the registry |
If you give values for any of sm, sw, sd, st, em, ew, ed, et, or shift, you must give values for all of them. Otherwise, the entire statement is considered not valid, and the time zone information is not changed.
![]()
Application Run-Time Environment Variables
Localization and Locales
![]()
Set Windows Run-Time
Environment Variables
Set OS/2 Run-Time
Environment Variables
Make Your Program International
