1754366 Members
4775 Online
108813 Solutions
New Discussion юеВ

Setting Date Format

 
Kennedy_1
Occasional Contributor

Setting Date Format

How do I Change the date format from mm/dd/yyyy to dd/mm/yy(European Format) in my server HPUX 11 without rebooting
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Setting Date Format

Hi,
Your question isn't very specific so I'm not sure if you are trying to do this a a system-wide sense or a local sense. Here goes:
If all you want is to format a date command,
date '+%d/%m/%y' will do it.
If you are looking for a more general answer then you will need to set and export the LANG variable. (man date, locale to get started)

try this as an example:
do a date command and note the format
now export LANG="en_GB.roman8"
and date again.

Note: Application programs are not guaranteed to properly use the locale; they should but again no guaratee's.

Hope this gets you started, Clay
If it ain't broke, I can fix that.
Vincenzo Restuccia
Honored Contributor

Re: Setting Date Format

date [-u] [mmddhhmm[[cc]yy]]mm

Kennedy_1
Occasional Contributor

Re: Setting Date Format

In my case Im doing a testing. I want to check if this software works fin even if the date format is set to european format.From your reply I can see the difference whe I echo date. Also how do I reset to the US Date Format
Thanks
A. Clay Stephenson
Acclaimed Contributor

Re: Setting Date Format

Hi,
You can simply do an unset LANG and the default behavior will kick in.

Bear in mind, if you set LANG and export, that only this shell and its child processes.
This is not a system-wide change; anything you do is safe.

Clay
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Setting Date Format

Hi:

To reset LANG to its default, do:

# export LANG=POSIX

To see other options, do:

# locale -a

...JRF...