Correct usage of tzset(), TZ env

https://knowledgebase.progress.com/articles/Article/000044163
TZ variable can be set on on for a session, user profile or use it in the Database start-up script to start the database for the specific timezone or country or city.

Following are some examples can be tested in a terminal session of UNIX.

For China is UTC+8:00 or GMT+8:00

TZ needs to set it with opposite sign as follows:

TZ=UTC-8:00; export TZ
or,
TZ=GMT-8:00; export TZ
or,
TZ=Asia/Shanghai;export TZ

setenv("TZ", "GMT-8:00", 1)
tzset();

For US EST (GMT-5:00, New York):

TZ=UTC+5:00; export TZ
Or,
TZ=GMT+5:00; export TZ
Or,
TZ=America/New_York;export TZ

setenv("TZ", "UTC+5:00", 1)
tzset();

Subscribe to Post, Code and Quiet Time.

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe