Hello!
I need to calculate number of days between two dates.
The first date is in format of string.
The second one is in format of date (current date):
#!/usr/bin/ksh
export ORACLE_HOME=/software/oracle/PROD10gR2
cd /etc/ORACLE/WALLETS/oracle
export EXP_DATE=`. $ORACLE_HOME/bin/orapki cert display -cert ca64.cer -summary| grep "Valid Until"|cut -f -4`
STRING=$EXP_DATE
STRING=${STRING#???????????????????}
BSTRING=${STRING%????????????????????????}
ESTRING=${STRING#??????????????????????????}
NEW_EXP_DATE=$BSTRING$ESTRING
echo $NEW_EXP_DATE
cur_time=`date +"%h %d %EY"`
last_date=`date -d $NEW_EXP_DATE +"%h %d %EY"`
The last command is failed with error:
date: extra operand `2011'
How can we convert this script to date and then calculate the day difference?
Thank you.