Skip to content

Instantly share code, notes, and snippets.

@wvpv
Last active July 31, 2017 02:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wvpv/1e90c62d05cdee6fff8981e935a7eda4 to your computer and use it in GitHub Desktop.
%%[
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