date program in ksh

#Author :  kkodava
#!/usr/bin/ksh
#Use of this program is You can findout the no of days & day of starting and ending dates 
#usage no_of_days startdate<yyyymmdd>  enddate<yyyymmdd>
syy=`echo $1|cut -c1-4`
smm=`echo $1|cut -c5-6`
sdd=`echo $1|cut -c7-8`

eyy=`echo $2|cut -c1-4`
emm=`echo $2|cut -c5-6`
edd=`echo $2|cut -c7-8`

tyy=`date +%Y`
tmm=`date +%m`
tdd=`date +%d`
aa=`date +%Ou`
kk=$aa
d[1]='Monday'
d[2]='Tuesday'
d[3]='Wednesday'
d[4]='Thursday'
d[5]='Friday'
d[6]='Saturday'
d[7]='Sunday'


sjdt=`expr \( 1461 \* \( $syy + 4800 + \( $smm - 14 \) / 12 \) \) / 4 + \( 367 \* \( $smm - 2 - 12 \* \( \( $smm - 14 \) / 12 \) \) \) / 12 - \( 3 \* \( \( $syy + 4900 + \( $smm - 14 \) / 12 \) / 100 \) \) / 4 + $sdd - 32075`

ejdt=`expr \( 1461 \* \( $eyy + 4800 + \( $emm - 14 \) / 12 \) \) / 4 + \( 367 \* \( $emm - 2 - 12 \* \( \( $emm - 14 \) / 12 \) \) \) / 12 - \( 3 \* \( \( $eyy + 4900 + \( $emm - 14 \) / 12 \) / 100 \) \) / 4 + $edd - 32075`

tjdt=`expr \( 1461 \* \( $tyy + 4800 + \( $tmm - 14 \) / 12 \) \) / 4 + \( 367 \* \( $tmm - 2 - 12 \* \( \( $tmm - 14 \) / 12 \) \) \) / 12 - \( 3 \* \( \( $tyy + 4900 + \( $tmm - 14 \) / 12 \) / 100 \) \) / 4 + $tdd - 32075`


nod=`expr $ejdt - $sjdt`

nod1=`expr $tjdt - $sjdt`

nod2=`expr $tjdt - $ejdt`

n1=`date +%Ou`

if [ $nod1 -lt 0 ]
then
	nod1=`expr $nod1 \* -1`
	nod1=`expr $nod1 % 7`

	while [ $nod1 -gt 0 ]
	do 
		nod1=`expr $nod1 - 1`
		n1=`expr $n1 + 1`

		if [ $n1 -gt 7 ] 
		then
			n1=1
		fi
	done
fi

if [ $nod1 -gt 0 ]
then
	nod1=`expr $nod1 % 7`

	while [ $nod1 -gt 0 ]
	do 
		nod1=`expr $nod1 - 1`
		n1=`expr $n1 - 1`

		if [ $n1 -eq 0 ] 
		then
			n1=7
		fi
	done
fi

n2=`date +%Ou`

if [ $nod2 -lt 0 ]
then
	nod2=`expr $nod2 \* -1`
	nod2=`expr $nod2 % 7`

	while [ $nod2 -gt 0 ]
	do 
		nod2=`expr $nod2 - 1`
		n2=`expr $n2 + 1`

		if [ $n2 -gt 7 ] 
		then
			n2=1
		fi
	done
fi

if [ $nod2 -gt 0 ]
then
	nod2=`expr $nod2 % 7`

	while [ $nod2 -gt 0 ]
	do 
		nod2=`expr $nod2 - 1`
		n2=`expr $n2 - 1`

		if [ $n2 -eq 0 ] 
		then
			n2=7
		fi
	done
fi

echo start_date : $1 ${d[n1]} + $nod days = end_date : $2 ${d[n2]}

added code tags for readability --oombera

If this is meant to be ksh shell script then why are you using the old and messy backquotes instead $() and expr instead of $(())?