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

Change Date format in HPUX Server

sprakash1980
Occasional Advisor

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
4 REPLIES
Patrick Wallek
Honored Contributor

Re: Change Date format in HPUX Server

Change the date format where? What date do you wish to display differently?
Manix
Honored Contributor

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
Hakki Aydin Ucar
Honored Contributor

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
Dennis Handly
Acclaimed Contributor

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"