Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: OT-is there a way to do this in unix - date question

Re: OT-is there a way to do this in unix - date question

From: Peter Johnson <paj1_at_humboldt.edu>
Date: Fri, 11 Feb 2005 10:55:26 -0800
Message-Id: <200502111055.26895.paj1@humboldt.edu>

This works in csh/tcsh.

 > alias getmonth "cal \!:1 01 | head -1 | sed -e 's/ *\(...\).*/\1/'"  > getmonth 11
Nov
 > getmonth 1
Jan
 > getmonth 2
Feb

On Wednesday 02 February 2005 06:36 pm, you wrote:
> This works in bash and korn. Put it into your .kshrc or .bashrc
>
> initmonths() {
> typeset m
> typeset i
> echo Initializing months...
> for m in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
> do
> ((i=i+1))
> months[$i]=$m
> done
> }
>
> getmonth() {
> typeset n=$1
> [ -z "${months[${n}]}" ] && initmonths
> echo ${months[${n}]}
> }
>
> getmonth 4
> getmonth 7
> getmonth 11
>
> That was fun, I should do more of that. :)
>
>
>
> On Wed, 2 Feb 2005 14:12:23 -0500, Michael McMullen
>
> <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
Received on Fri Feb 11 2005 - 13:58:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US