To combine this with additional information. The solution above is perfect if you want the first day of the month, say you want the last day of the month, or in my case I want the last day of the next quarter.
From above i did
date('0001-01-31') + year(date(prevQdate))years - 1 year + month(prevQdate) months + 2 months)
Which did not give me what I wanted, sometimes the date was 30th and not 31st months with a 31-day ...
Change it to
date('0001-01-31') + year(date(prevQdate))years - 1 year + **(month(prevQdate) + 2)** months)
Gave me what I wanted. It appears that the first addition of the Months from the previous quarter of the date was a reset of a portion of DAY of my date, and thus the second addition of the months worked with a date of only 30 days in the month.
You just have to be careful when using this date processing method in DB2.
Madmurf
source share