System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the time and time zone

SOLVED
Go to solution
senthil_kumar_1
Super Advisor

How to change the time and time zone

Hi All,

i want to change the time and time zone (CST).

My current setting:

# date
Tue Dec 1 09:29:23 NST 2009
14 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: How to change the time and time zone

Hi:

You can use:

# /sbin/set_parms timezone

...to trigger an interactive reset.

Otherwise, change '/etc/TIMEZONE' and '/etc/default/tz' to reflect your correct zone.

Since a "timezone" is a +- offset from UTC (also known as GMT) and since UNIX handles time in epoch UTC seconds, do _not_ adjust your actual server time if it is already correct. You can verify it with:

# date -u

...and compare the value returned to an reliable external source. Of course you _should_ also be running NTP to keep your server's time synchronized.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: How to change the time and time zone

Shalom and good morning.

I would use set_parms timezone

In this case.

That utility must be run by root.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rita C Workman
Honored Contributor

Re: How to change the time and time zone

I concur with the learned gentlemen who have answered already.

Just a word of caution. Remember, that if you change time settings you must be sure that you will not affect applications, if you are backing up in time.
Software, such as Oracle, are timestamped for transactions and would be adversely affected in the event of a time backup. Going forward - no big deal.

Kindest regards,
Rita
Dennis Handly
Acclaimed Contributor

Re: How to change the time and time zone

>Rita: if you change time settings you must be sure that you will not affect applications

This shouldn't apply if you are just changing timezones.
Kranti Mahmud
Honored Contributor

Re: How to change the time and time zone

Hi Senthil,

You didn't mention that you wanna go forward or backward.

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!
Kranti Mahmud
Honored Contributor

Re: How to change the time and time zone

Hi Senthil,

To change the TIMEZONE, you need to do the following steps:

1. edit /etc/TIMEZONE so that it contains the following two lines:

TZ=CST-XXXX (XXXX=your desired time standard)
export TZ

2. edit /etc/default/tz

3.Edit the tztab file
# cd /usr/lib
#cp â p tztab /tmp/dst (copy tztab to /tmp/dst)
# vi tztab

4.#shutdown â ry now

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!
Taifur
Respected Contributor

Re: How to change the time and time zone


Hi Senthil,

For changing time you can use

#date -u

For time zone, you have to edit
#vi /etc/TIMEZONE
&
#vi /etc/default/tz file

http://docs.hp.com/en/B3921-90010/timezone.5.html

Rgds//
Taifur
Dennis Handly
Acclaimed Contributor

Re: How to change the time and time zone

>Kranti: To change the TIMEZONE
>3. Edit the tztab file

There is no need to do this unless you are creating NEW timezones.

You can also simply export TZ in your .profile to your new timezone.
sujit kumar singh
Honored Contributor

Re: How to change the time and time zone

Hi


set_parms date_time
set_parms timezone

regards
sujit
mvpel
Trusted Contributor

Re: How to change the time and time zone

Does set_parms change the system-wide time zone, such as what timestamp is used in syslog and for cron jobs? If not you might need a reboot to fully implement the new time zone in every respect.

The time zone is essentially a display filter - the system clock is always in UTC, so I wouldn't think that changing the time zone would affect Oracle database transactions.
senthil_kumar_1
Super Advisor

Re: How to change the time and time zone

Do we need to restart the server after changing the TIME ZONE?

Since the time zone has not been changed even after changing the time zone using the command "#/sbin/set_parms timezone"


FYI...

# date
Wed Dec 9 07:00:07 NST 2009

# more /etc/default/tz
CST6CDT

# more /etc/TIMEZONE
TZ=CST6CDT
export TZ


So do i need to restart the server to effect the new time zone?

or how to do this with out restart?
James R. Ferguson
Acclaimed Contributor

Re: How to change the time and time zone

Hi Senthil:

> Do we need to restart the server after changing the TIME ZONE?

Processes that were started before the change that continue to run will need to be restarted to see the new timezone rules if this is important to them.

For your sanity, I would reboot.

Regards!

...JRF...
Sp4admin
Trusted Contributor

Re: How to change the time and time zone

Looks like you got the answer. I use the "set_parms timezone" command to set the date and time.

sp,
Dennis Handly
Acclaimed Contributor

Re: How to change the time and time zone

>how to do this with out restart?

For an individual user you can just use:
. /etc/TIMEZONE

As JRF says, for system demons/processes, you probably have to reboot.