Operating System - HP-UX
1748146 Members
3662 Online
108758 Solutions
New Discussion юеВ

Re: date one hour behind, how to change EST to EDT in date comman ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

date one hour behind, how to change EST to EDT in date comman ?

# cat /etc/TIMEZONE
TZ=EST5EDT
export TZ
# date
Tue May 12 13:46:28 EST 2009
# date
Tue May 12 13:48:10 EST 2009
good judgement comes from experience and experience comes from bad judgement.
5 REPLIES 5
Sammy_2
Super Advisor

Re: date one hour behind, how to change EST to EDT in date comman ?


Also, why does $TZ show this and not what I have in TIMEZONE file.
# echo $TZ
EST5EST
good judgement comes from experience and experience comes from bad judgement.
UVK
Trusted Contributor
Solution

Re: date one hour behind, how to change EST to EDT in date comman ?

Sammy,

First to fix ur problem try doing this.

# TZ=EST5EDT
# export TZ
# date

see if you get the right time.

Whats the time stamp on /etc/TIMEZONE file. Did someone change it after last reboot ?

Cheers,
-uvk
-------------------------------------------
Like it or worked !! Click kudos !!
Sammy_2
Super Advisor

Re: date one hour behind, how to change EST to EDT in date comman ?

# ls -l /etc/TIMEZONE
-r--r--r-- 1 bin bin 21 May 12 07:55 /etc/TIMEZONE
# last reboot
reboot system boot Sun Feb 1 10:11 still logged in


Apparently, someone changed it after last reboot.
I tried you commands and it seems to revert to correct time.
Thanks
good judgement comes from experience and experience comes from bad judgement.
Bill Hassell
Honored Contributor

Re: date one hour behind, how to change EST to EDT in date comman ?

Just a note about time on HP-UX. The time is always UTC (aka, GMT). The TZ variable directs the system library functions to translate the system time into one of dozens (including your own private timezone if you wish). TZ should always be derived from /etc/profile for all users, but for users located in other timezones, they can change TZ in their local .profile so not only the date/time look normal, but all the timestamps on files and directories will be translated.

Here's a quick way to demonstrate TZ's effect:

TZ=EST5EDT date
TZ=PST8PDT date
TZ=BillHassell6:21 date

A timezone with offsets to minutes and seconds works just fine. TZ only affects what you see -- system time is never changed. See the man page for environ and tzab.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: date one hour behind, how to change EST to EDT in date comman ?

>why does $TZ show this and not what I have in TIMEZONE file?

Because setting TZ always overrides setting of some file.

You can get the value out of the file by:
. /etc/TIMEZONE

Or you can reboot.