Formatting Date Variable (Pls help)

I have a situation where I am writing a shell script that will accept a date value it will then pass this date value to an Oracle stored procedure for processing.

I want to format the date into (01-SEP-08) before passing to the proc. I also want to make sure the value passed in is a date value if its not then i need to display an error message i.e. Invalid Date.

I am new to this language and in language's like Java etc this would be a 1 liner just call a function pass in the date along with the format you want.
Is this achievable with a Shell Script?

Here is my code...

#!/bin/ksh

DATE=$1

if [ -z "$DATE" ] #I first check for null and format sysdate which is no problem
then
DATE=`date '+%d-%b-%y`
echo $DATE
else
#This is where I want to format the arg variable how can I do that?
echo $DATE
fi

Please help...

Try:

#!/bin/ksh

DATE=$1

if [[ -z "$DATE" ]] #I first check for null and format sysdate which is no problem
then
	DATE=`date +%d-%b-%y"`
	echo $DATE
else
	#This is where I want to format the arg variable how can I do that?
	DATE=$(echo "$1" | tr -s '[:lower:]' '[:upper:]')	
	echo $DATE
	# test validity of date given
	echo "
      set pages 0
      set feedback off
      select 'OK' 
      from 
        dual
      where 
        to_date($(printf "'%s'" $DATE),'DD-MON-YYYY') > to_date('01-JAN-1000','DD-MON-YYYY');
      " | sqlplus -s jmcnama/555tgb | read okay
      if [[ "$okay" = "OK" ]] ; then
           echo "good date"
      else
           echo "bad date"
      fi          
fi