Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
%%[
set @today = now()
set @monthOfThisMonth = DatePart(@today, "M")
set @yearOfThisMonth = DatePart(@today, "Y")
set @firstDayOfThisMonth = dateparse(concat(@monthOfThisMonth,"/01/",@yearOfThisMonth))
set @nextMonth = dateadd(@today, 1, "M")
set @monthOfNextMonth = DatePart(@nextMonth, "M")
set @yearOfNextMonth = DatePart(@nextMonth, "Y")
set @firstDayOfNextMonth = dateparse(concat(@monthOfNextMonth,"/01/",@yearOfNextMonth))
set @lastDayOfThisMonth = dateadd(@firstDayOfNextMonth,-1,"D")
]%%
@today: %%=v(@today)=%%
<br>@monthOfThisMonth: %%=v(@monthOfThisMonth)=%%
<br>@yearOfThisMonth: %%=v(@yearOfThisMonth)=%%
<br>@firstDayOfThisMonth: %%=v(@firstDayOfThisMonth)=%%
<br>@nextMonth: %%=v(@nextMonth)=%%
<br>@monthOfNextMonth: %%=v(@monthOfNextMonth)=%%
<br>@yearOfNextMonth: %%=v(@yearOfNextMonth)=%%
<br>@firstDayOfNextMonth: %%=v(@firstDayOfNextMonth)=%%
<br>@lastDayOfThisMonth: %%=v(@lastDayOfThisMonth)=%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment