Just one additional thing to Adam Spriggs answer which might be a very valuable information. If your marketing cloud Date Format is not set on English the solution of Adam will NOT work inside email previews but in send emails and in cloudpages, because the DateParse function will be handled differently.
Example for German Date Format on the 26th February 2020, with the code on top inside an email PREVIEW:
now(): 2/26/2020 8:58:49 AM
@twoMonthsDate: 4/26/2020 8:58:49 AM
@month: 04
@year: 2020
@firstOfTwoMonthsDate: 1/4/2020 12:00:00 AM
@lastDayNextMonth: 1/3/2020 12:00:00 AM
Example for German Date Format on the 26th February 2020, with the code on top inside a Cloudpage:
now(): 2/26/2020 9:15:31 AM
@twoMonthsDate: 4/26/2020 9:15:31 AM
@month: 04
@year: 2020
@firstOfTwoMonthsDate: 4/1/2020 12:00:00 AM
@lastDayNextMonth: 3/31/2020 12:00:00 AM
When you change the DateParse to dateparse(concat("01.",@month,".",@year))
in the Email PREVIEW the results in this:
now(): 2/26/2020 9:00:12 AM
@twoMonthsDate: 4/26/2020 9:00:12 AM
@month: 04
@year: 2020
@firstOfTwoMonthsDate: 4/1/2020 12:00:00 AM
@lastDayNextMonth: 3/31/2020 12:00:00 AM
But in the inbox the email looks like this:
@twoMonthsDate: 4/26/2020 8:58:49 AM
@month: 04
@year: 2020
@firstOfTwoMonthsDate: 1/4/2020 12:00:00 AM
@lastDayNextMonth: 1/3/2020 12:00:00 AM
I was actually unaware that the Date Format of the Marketing Cloud Instance will influence the AMPScript functions in that matter, but only in emails-previews but not on cloudpages or on actual email sends(WTF?!!!!!!!!!).
Holy shit what is this?