changing timezone in Oracle Solaris 11.2

21,984

Solution 1

To answer your question, use the instructions in the second link, summarized here. This will change the system-wide default timezone for libraries and utilities that print or return the time. It will not affect the actual contents of the real-time clock in the hardware (or virtual machine host infrastructure for a VM). The rtc command is used to configure the actual time stored in the hardware. You need to worry about that if you're going to be frequently rebooting from Solaris into Windows on the same hardware and you need to make sure they both understand the time value that's stored in the hardware realtime lock chip.

In Solaris 11.2 you can use the nlsadm utility to set this.

# date
Tuesday, December 15, 2015 08:54:04 PM UTC
# nlsadm get-timezone
timezone=UTC
# nlsadm list-timezone | grep US/Pacific
US/Pacific
# nlsadm set-timezone US/Pacific
Reading IPS package information ...
Setting SMF property timezone/localtime with value: 'US/Pacific' ...
Successfully set
# date
Tuesday, December 15, 2015 12:54:24 PM PST

You may need to install the nls-administration package using

# pkg install nls-administration

There is a man page for the nlsadm utility which is installed with the binary. Here is a link to the documentation describing the process.

http://docs.oracle.com/cd/E36784_01/html/E39134/gllkr.html

Under the covers, the nlsadm utility will use the svccfg commands described in an earlier answer. And under those covers there is a symlink in /etc for backwards compatibility. That's right, it's just covers all the way down. :-)

Solution 2

nlsadm can also be used to set the timezone, along with other locale specifics such as language and keyboard.

Look for the timezone:

solaris11 [8]# nlsadm list-timezone | grep -i <TIME_ZONE>

Set the timezone:

solaris11 [9]# nlsadm set-timezone <TIME_ZONE>

Solution 3

You should use TZ=localtime on Solaris 11. It is a symbolic link to actual timezone file, but it allows to switch timezones without restarting processes.

This symlink is created by svc:/system/timezone:default SMF service, so simply update its configuration:

# svccfg -s timezone:default
svc:/system/timezone:default> setprop timezone/localtime = Europe/Moscow
svc:/system/timezone:default> end
# svcadm refresh timezone
Share:
21,984

Related videos on Youtube

Mark
Author by

Mark

Updated on September 18, 2022

Comments

  • Mark
    Mark almost 2 years

    I'm confused: what is the right way to change TZ on a freshly installed Solaris 11.2?

    I have found these, but am unsure which to use:

    • MusiGenesis
      MusiGenesis about 9 years
      The first link, referring to rtc, is not about changing the timezone of the system clock, but the offset between the OS clock and the BIOS clock.
  • Mark
    Mark about 9 years
    thanks for feedback. After completing these commands, where can I see the changes, which config files are supposed to be updated with new timezone? Also, date still reports old timezone.
  • sleepyweasel
    sleepyweasel over 7 years
    You can also run nlsadm list-timezone to view timezones that you can pick from.
  • AhmadKarim
    AhmadKarim over 7 years
    Thanks sleepyweasel, I added that to the example commands.