Operating System - HP-UX
1847176 Members
6018 Online
110263 Solutions
New Discussion

Re: Displayed time format

 
SOLVED
Go to solution
YLTan
Frequent Advisor

Displayed time format

Hi

I am having a system which display time and date in the following format when I run the date command;

Wed Jun 12 17:39:55 GMT 2002

How do I change it to 12Hours format like this;

Wed Jun 12 5:39:55 GMT 2002


any help would be appreciated.

regards
yihliang
tyl
6 REPLIES 6
Michael Tully
Honored Contributor

Re: Displayed time format

Hi,

You can display what you want in the following format:

# date "+%a %b %d %I:%m:%S GMT %Y"
Thu Jun 13 04:06:04 GMT 2002

As long your timezone is correct you can do this.

Michael
Anyone for a Mutiny ?
YLTan
Frequent Advisor

Re: Displayed time format

Hi,

I actually need the system to be in 12Hours format ( it is now in 24hours format), and not just displaying the date for one time. i.e. each time i type command 'date' i need the display to be in 12Hours format.

any ideas?

regards
yihliang
tyl
Michael Tully
Honored Contributor

Re: Displayed time format

Hi,

The system clock runs as a 24 hour clock. There is not a lot you can do about it, unless you wrote some sort of 'c' program that can use the 'ctime' and various other 'time' related libraries. There is man page for 'ctime' have look there for starters.

Why do wish to do this??
Anyone for a Mutiny ?
YLTan
Frequent Advisor

Re: Displayed time format

Hi Micheal,

I got an Oracle database export from another server and I am trying to import it into this server and Oracle saids;

ORA-01874: time zone hour must be between -12 and 13

Oracle action is 'Specify a time zone hour between -12 and 13.'

So I was wondering if the system time format have anything to do with it. Since the diff. bet. the two system is the 12H on one server while the other is 24H format.

any ideas?

regards
yihliang
tyl
Michael Tully
Honored Contributor
Solution

Re: Displayed time format

Hi,

okay... What this is asking for is your timezone. It is asking how many hours + or - you are from GMT. On my site I am -10 hours from GMT.

# echo $TZ
EST-10EDT

Also have a look in either /etc/TIMEZONE and or
/usr/lib/tztab. So as an example I would be -10

HTH
Michael
Anyone for a Mutiny ?
RikTytgat
Honored Contributor

Re: Displayed time format

Hi,

System time format has absolutely nothing to do with your Oracle import problem. The format that is used for the 'date' command is determined by the locale you are using.

Use the command 'locale' to check your settings.

It is possible to create your own locales, if you want. Check out the followinf manpages:
localedef(1m)
localedef(4)

Bye,
Rik