needs to display month for previous day date

Hello,

I wanted to display the month for previous day date. Like, today date is 18-Nov-2008. So the previous date is 17-Nov-2008. The output should be November.

If the today date is 1-DEC-2008, then output should be NOVEMBER.
If the today date is 1-JAN-2008, then output should be DECEMBER.
If the today date is 31-DEC-2008 then output should be DECEMBER.

Here is the code i am having now.

export FILE_FORMAT=`date '+%B`
echo $FILE_FORMAT

it is working for the below scenario

If the today date is 1-DEC-2008, then output should be NOVEMBER.
If the today date is 1-JAN-2008, then output should be DECEMBER.

Any help is appreciated...

Let's say your in Central Time zone.

Your timezone might be represented by
TZ=CST6CDT

You could get the prior day by doing
TZ=CST30CDT
(6 + 24 = 30)

So:
$ TZ=CST30CDT date +%B

Should give you yesterday.

Alternatively you can install GNU's date program which can do date arithmetic.

If you are using ksh93

$ printf "%(%B)T" "yesterday"

Thanks Murphy.

Cjcox, Let me test this on Jan 1st 2009 and see it is displaying December.

Currently it is displaying december.. But this is not a real test now.

xx=CST30CDT date +%B
echo $xx

Thank you again.

date --d='1 days ago'  +%B

This is assuming GNU date.

You can test it like this:

# date -d "2008-01-01" --date='1 days ago' +%B
December