Working with dates
I need to do some stuff to a date in a script, and I can't quite figure out how to do certain things:
First of all, I have a date. (it's either Get (CurrentDate) or it comes as a script parameter) The script assumes that this is the first work day of a new month, (next one would be July 2nd) finds all the orders for the last two months, sucks data out of them and feed them into a report.
So what I need to do is somehow get the values for the last two months from this date. In case of July 2nd, I need $month1 value to be 2012/05/01 or just 2012/05 (May 2012) and $month2 to be 2012/06/01 (or 2012/06)
Second thing I need to do, is search for values that correspond to that one month. I know how to search within a date range, ( $date1 .. $date2) but how do I say "find me records that have date somewhere in April 2012"