How do I format a date in a KornShell (ksh) script on DD-MON-YYYY?
I tried the following:
date '+%d-%h-%Y'
He returns November 04, 2009 I need NOV (all caps) to be new. Can this be done with the date utility?
This is what finally worked on unix (solaris).
date '+%d-%h-%Y' | tr [:lower:] [:upper:]
: 04-NOV-2009
The ^ character delays an uppercase letter in GNU coreutils date (at least in version 6.9.92.4 from coreutils):
date
$ date '+%d-%^h-%Y' 04-NOV-2009
Unfortunately, ^ is not the POSIX standard for date , so you may have to resort to a second command such as tr suggested by @martin clayton if you are not using the GNU system.
tr
You can make it up yourself if your environment does not support capitalization:
date '+%d-%h-%Y' | tr 'az' 'AZ'