calculate the date of next satureday of current date.

I want to calculate the date of next satureday of current date using shell script.

Suppose, today is 27-feb-08
I want to get the date of next satureday, which means 01-mar-08, in the formate '' YYMMDD ".

I do this in ksh..

Please tell me any type of command which help me out.

Thanks in advance...

Got gnu date?

$ date -d 'next sat' '+%y%m%d'
080301

The date -d option is not working for me...

I want to find the future date i.e. next monday.
The date format be anything just need to have a validation check for my application program. Help me on this.

Try this function...

#!/usr/bin/ksh

function dayshift {
  perl -e '@f = localtime(time+(86400*$ARGV[0]));
    printf "%04d%02d%02d\n", $f[5]+1900, $f[4]+1, $f[3];' -- $1
}

NEXT_MONDAY=$(dayshift $((8-$(date '+%u'))))

...format is YYYYMMDD, but change the printf if you want.