Re: Change Date format in HPUX Server (1530 Views)
Reply
Occasional Advisor
Posts: 14
Registered: ‎10-11-2010
Message 1 of 5 (1,530 Views)

Change Date format in HPUX Server

I would like to change the date format in HPUX to dd/mm/yyyy permanently. How do i change the format and what is the command line i need to use to change it .PLease assist
Honored Contributor
Posts: 13,913
Registered: ‎06-21-2000
Message 2 of 5 (1,530 Views)

Re: Change Date format in HPUX Server

Change the date format where? What date do you wish to display differently?
Honored Contributor
Posts: 518
Registered: ‎12-03-2010
Message 3 of 5 (1,530 Views)

Re: Change Date format in HPUX Server

You have to use the below command.
date [-u] [mmddhhmm[[cc]yy]]
date -u 032912202008

mm - Month number [01-12].
dd - Day number in the month [01-31].
hh - Hour number (24-hour system) [00-23].
mm - Minute number [00-59].
cc - Century minus one [19-20].
yy - Last two digits of the year number [70-99, 00-37 (1970-1999, 2000-2037)]. If omitted, the current year is used.

Thanks
Manix
HP-UX been always lovable - Mani Kalra
Honored Contributor
Posts: 1,314
Registered: ‎08-16-2006
Message 4 of 5 (1,530 Views)

Re: Change Date format in HPUX Server

it is not recommended request due to date might be used by critical applications in your server.
One simple solution may be put into profile of specific user ;

alias date='date "+%d/%m/%Y"'

if you want put it back;

unalias date
Highlighted
Acclaimed Contributor
Posts: 26,111
Registered: ‎03-06-2006
Message 5 of 5 (1,530 Views)

Re: Change Date format in HPUX Server

>I would like to change the date format in HP-UX to dd/mm/yyyy permanently.

What locale are you in? Perhaps if you select the right one, you get what you want.
$ TZ=UTC0 LANG=en_GB.utf8 date
Wed. 02 Mar, 2011 08:37:16 AM

You need to modify this part of a locale:
$ locale -k d_fmt
d_fmt="%m/%d/%y"

These locales:
pt_PT.utf8:
pt_BR.iso88591:
pt_BR.iso885915:
pt_BR.utf8:
pt_PT.iso88591:
pt_PT.iso885915@euro:
pt_PT.roman8:
d_fmt="%d/%m/%Y"
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.