I have two variables: X and Y.
The value of X will be a date given in the format mmddyy and I want to calculate the date preceding that date
Since the -d option doesn't exists on MacOS X or FreeBSD, here is the answer for them
Retrieving a date relative to current time
date -v -1d
For your question in particular, you'll need the -j and -f flags to use a specific date
date -v -1d -j -f %m%d%y 091509 +%Y%m%d