You found the answer almost yourself. The key is the "date()" function.
date("Y-m-d") accepts yet another parameter: the timestamp. Without this timestamp, date() assumes the date of today. But you certainly can specify the timestamp to be any other date.
date("Y-m-d", strtotime("-4 month"))
Guess what this does? ;-)