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: date format in ksh

RE: date format in ksh

From: Deshpande, Kirti <kirti.deshpande_at_verizon.com>
Date: Sat, 27 Oct 2001 10:43:32 -0700
Message-ID: <F001.003B6648.20011027104518@fatcity.com>

Suhen,
If all you want is a format check (and no date validation) here is a way to do it:

#!/usr/bin/ksh
REQD=ZZ-ZZZ-ZZ RCVD=`echo $1| tr '[A-Z] | [a-z] | [0-9]' '[Z*]'`

if [ $REQD = $RCVD ]
then
  echo "Input Format is Okay"
else
  echo "Input Format is WRONG"
fi

HTH, Regards,

> -----Original Message-----
> From: Suhen Pather [SMTP:Suhen.Pather_at_strandbags.com.au]
> Sent: Friday, October 26, 2001 7:40 PM
> To: Multiple recipients of list ORACLE-L
> Subject: RE: date format in ksh
>
> Jared,
>
> Thanks for the reply.
> I am passing a hardcoded date.
> I am not getting a date from the
> "date" command in ksh.
>
> What my ksh does is retrieves $1 and must check if the date format
> is in DD-MON-YY eg. 02-FEB-01.
> It uses the hardcoded date (passed in as argument 1) in the script.
> If the date is in another format other than above then it must exit.
>
> Regards
> Suhen
>
>
>
>
>
> date +%d-%b-%Y
>
> man date.
>
> You may have to look at the man page on a system with more
> recent documentation, such as linux. The man page on
> Solaris is incomplete.
>
> JARed
>
>
>
>
>
>
> Suhen Pather
>
> <Suhen.Pather_at_strandba To: Multiple
> recipients
> of list ORACLE-L <ORACLE-L_at_fatcity.com>
> gs.com.au> cc:
>
> Sent by: Subject: date format
> in
> ksh
> root_at_fatcity.com
>
>
>
>
>
> 10/25/01 08:00 PM
>
> Please respond to
>
> ORACLE-L
>
>
>
>
>
>
>
>
>
> List,
>
>
>
>
>
> Sorry to deviate from the topic, but
>
>
> I am writing a korn shell script that would exit if the date format is
>
>
> incorrect.
>
>
>
>
>
> I just need something to compare the date format passed in with
> DD-MON-YYYY.
>
>
>
>
>
> Eg.
>
>
> I am passing an argument to my ksh script being the date.
>
>
> If the date is in any other format but DD-MON-YYYY the ksh must exit.
>
>
>
>
>
> Eg. sh test.ksh 02/05/1999
>
>
>
>
>
> It must exit.
>
>
>
>
>
> The only format excepted should be
>
>
> sh test.ksh 02-MON-YYYY
>
>
>
>
>
> TIA
>
>
>
>
>
> Regards
>
>
> Suhen
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Suhen Pather
> INET: Suhen.Pather_at_strandbags.com.au
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Deshpande, Kirti
  INET: kirti.deshpande_at_verizon.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Sat Oct 27 2001 - 12:43:32 CDT

Original text of this message

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