Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: OT-is there a way to do this in unix - date question
#! /bin/sh # Copyleft (C) 2005 Rightsizing, Inc. # # mm2mon -- wrapper for date to return 3 char month abbrev from numeric arg # with not even a hint of error checking. # # Usage: mm2mon <arg> #
This seems to work. The returns change based on your local language, though.
If you have a version of the date command that does not take the -d argument
this
will laugh at you, otherwise it should work fine.
A real shell person may know a cheaper way to format the string than
invoking printf;
that part of my brain is off on tape somewhere. I think you have to give
the -d option
a formatted string and it will figure out yymmdd and yyyymmdd. In your case
any old
yyyy and dd will do.
If you want "like what you get with date +%b" then this is actually what you
want.
>
> <ganstadba_at_hotmail.com> wrote:
> > without writing a whole series of ifs, given a number 1 - 12 give the
> > corresponding three letter month
> > like what you get with date +%b, but someone supplies you the digits
> > --
> > http://www.freelists.org/webpage/oracle-l
-- Peter Johnson Humboldt State University 707-826-6122 -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Fri Feb 11 2005 - 17:34:21 CST
![]() |
![]() |