Extract Monday from given date

Hi

I want to extract the date on Monday depending upon the user input for that week.
For example if the input date is 20080528 then the output should be 20080526. If the input is 20080525 then it will be 20080519

i am working on IBM AIX

Thanks

try searching here

It may not be obvious how to use datecalc to find Monday.

$ echo $(datecalc -d 2008 05 28)
3
$ #  That 3 means it is Wed
$ echo $((1 - $(datecalc -d 2008 05 28) ))
-2
$ # How much we are off from Mon
$ echo $(datecalc -j 2008 05 28)
54614
$ # mjd of input date
$ echo $(( $(datecalc -j 2008 05 28) + 1 - $(datecalc -d 2008 05 28) ))
54612
$ #mjd of Monday
$ datecalc -j $(( $(datecalc -j 2008 05 28) + 1 - $(datecalc -d 2008 05 28) ))
2008 5 26
$ #desired output
$