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
Just double checking the elimination of the 3D that embedded into the =
email on send.
echo `date --date=3D$1/12/2005 +%b`
-----Original Message-----
From: oracle-l-bounce_at_freelists.org =
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Parker, Matthew
Sent: Friday, February 11, 2005 4:47 PM
To: mwf_at_rsiz.com; Oracle-L
Subject: RE: OT-is there a way to do this in unix - date question
You pretty much had it.
Linux
#!bin/sh
echo `date --date=3D3D$1/12/2005 +%b`
Other Unix OS's
#!bin/sh
echo `date -d=3D3D$1/12/2005 +%b`
Your script could just ececute this script, however it is probably just =
=3D
as easy to make it a function call within the shell script itself that =
=3D
needs this information or a direct variable call to the date funtion =3D
using the original passed variabl or internal variable from your =3D
program.
-----Original Message-----
From: oracle-l-bounce_at_freelists.org =3D
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Mark W. Farnham
Sent: Friday, February 11, 2005 2:28 PM
To: Oracle-L
Subject: 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 =
# with not even a hint of error checking. # # Usage: mm2mon <arg> #
This seems to work. The returns change based on your local language, =3D
though.
If you have a version of the date command that does not take the -d =3D
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 =3D
invoking printf; that part of my brain is off on tape somewhere. I think =
=3D
you have to give the -d option a formatted string and it will figure out =
=3D
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 =
=3D
you want.
> > <ganstadba_at_hotmail.com> wrote: > > without writing a whole series of ifs, given a number 1 - 12 =give=3D20
> > +%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-l -- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Fri Feb 11 2005 - 20:03:24 CST
![]() |
![]() |