Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need a date format of DD-MON-YYYY 3

Status
Not open for further replies.

tokerago13

Programmer
Jan 10, 2002
35
GB
Hi there,

If anyone can help I'll really be greatful. I need a date in the format DD-MON-YYYY i.e.14-JUL-2004. In my UNIX script what I can get is 14-Jul-2004 using date %d-%b%Y.
As I can't seem to get the correct date format, anyone know how I can convert the the date 14-Jul-2004 to 14-JUL-2004. what I'll need will be to convert Jul to JUL.
Any ideas will be much appreciated.

tokerago13
 
Try...
[tt] date '+%d-%b-%Y' | tr [:lower:] [:upper:][/tt]
 
There are several ways to achieve this, my personal favourite is:
datestring=`date +'%d-%b-%Y' | tr '[a-z]' '[A-Z]'`

which should work in Bourne and Korne shells (and bash).

I hope that helps.

Mike
 
Another variation of Mike's, for KornShell only:

typeset -u datestring=`date +"%d-%b-%Y`

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top