$ perl -MPOSIX=strftime -le 'print strftime "%Y%m%d", localtime(time - ((1 - (localtime)[6]) * -86400))' 20061002