Need Help:Shell Script for Solaris to change the dates in a file by one week

I have to increase the date by one week in an input when script is executed in solaris. I was able to acheive this using ksh script that is working in Linux enivironment, when i execute the same script in Solaris i am getting below error:

/var/tmp\n\r-> ./script.ksh
date: illegal option -- d
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
        date [-u] [+format]
        date -a [-]sss[.fff]
date: illegal option -- d
usage:  date [-u] mmddHHMM[[cc]yy][.SS]
        date [-u] [+format]
        date -a [-]sss[.fff]

Script.ksh file contains below script: For this file and input file is provided "in.dat"
Script.ksh:

#!/bin/ksh
dIFS="$IFS"
IFS=''
rm -f a.out
cat in.dat | while read ln
do
 FirstPart=""
 DatePart=""
 RemPart=""

        #print $ln
        Reqstr=`echo $ln| grep -i "Created Before"`
 Str1=`echo $Reqstr | tr -d ' '`
 if [[ "${Str1}X" != "X" ]];then
 
         FirstPart=`echo $Reqstr| cut -c 1-51`
         DatePart=`echo $Reqstr| cut -c 52-62`
         RemPart=`echo $Reqstr| cut -c 63-80`

  NewDatePart=`date -d "$DatePart 7 days" +"%d-%b-%Y"`
  #echo "NewDate is $NewDatePart"
         echo $FirstPart$NewDatePart$RemPart >> a.out
 else

         Reqstr=`echo $ln| grep -i "Created After"`
  Str2=`echo $Reqstr | tr -d ' '`
  if [[ "${Str2}X" != "X" ]];then
 
   FirstPart=`echo $Reqstr| cut -c 1-50`
   DatePart=`echo $Reqstr| cut -c 51-61`
   RemPart=`echo $Reqstr| cut -c 62-80`
 
 
   NewDatePart=`date -d "$DatePart 7 days" +"%d-%b-%Y"`
   #echo "NewDate is $NewDatePart"
 
          echo ${FirstPart}${NewDatePart}${RemPart} >> a.out
  else
   echo $ln >> a.out
  fi
 fi
 IFS=''
done
cp a.out in.dat 

in.dat file contains below content: When the above script.ksh is executed then the values of Creater After and Created Before dates should be increased by 7days

<?xml version="1.0" encoding="UTF-8"?>

<CrfReport>
  <SummaryReport command="execute" id="TC_2007_00_SUM_RPT_0011"
                 stylesheet_name="">
    <report_parameter name="Created After" value="
    <report_parameter name="Created Before" value="
    <report_option name="report_locale" value="en_US" />
  </SummaryReport>
</CrfReport>

Let me know if any information is needed.

Your error is due to the fact that the default date utility on Solaris does not support the -d option. You need to install the GNU date utility and give the right path to the date utility. It may already be installed. Check under /usr/sfw/bin.

I can see many files in the path you have told, but whats need be checked here?

I tried with this command

TZ=GMT-144 date +%d-%b-%Y

i am able to go back till 6 days but not up to 7 days.. any idea on this one?

If one of those files is named date, then see if it is the GNU date utility. If so, use it in your script instead of the default system date utility.