Can I change my time zone to New Zealand time?

The time displayed in your shell is controlled by a system variable called TZ. To change to New Zealand time you need to set the variable as follows:

export TZ="NZ"

This setting will automatically adjust for daylight saving, since the tzdata package is installed at the system level. Our system engineers will keep the tzdata package up to date.

Making the change persistent

You can make your time zone setting persistent by adding the above line to your ~/.bashrc. If you do this, we recommend adding the following line to your ~/.bash_profile, or to your ~/.profile if you have the latter but not the former:

test -r ~/.bashrc && . ~/.bashrc

Please see the article, ".bashrc or .bash_profile?" for more information.

What about cron jobs?

Your crontab file doesn't source either ~/.bashrc or ~/.bash_profile. If you want scripts that are run from crontab to know about your time zone setting, you must start the crontab file with this statement:



The TZ setting in your crontab controls the time as it appears to your cron jobs, but not when the cron jobs start. You must write the time specifications for individual cron jobs according to UTC, even if you have a different TZ setting.

Was this article helpful?
0 out of 0 found this helpful