Use AMPScript to find first and last days of the month

If you need to calculate the first and last day of the current month in AMPScript, you can do it like this:

Output:

@today: 7/30/2017 8:25:22 PM
@monthOfThisMonth: 07
@yearOfThisMonth: 2017
@firstDayOfThisMonth: 7/1/2017 12:00:00 AM
@nextMonth: 8/30/2017 8:25:22 PM
@monthOfNextMonth: 08
@yearOfNextMonth: 2017
@firstDayOfNextMonth: 8/1/2017 12:00:00 AM
@lastDayOfThisMonth: 7/31/2017 12:00:00 AM

Reference:

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz