I would like to use AMPScript to automate a date range, e.g.:

Prices effective: Tuesday, June 3 through Monday, June 9, 2014 unless otherwise noted.

I have:

Prices effective: %%xtdayofweek%%, %%xtmonth%% %%xtday%% through %%=Format(DateAdd(Now(), "6","D"), "MM/dd/yyyy")=%% unless otherwise noted.

But %%=Format(DateAdd(Now(), "6","D"), "MM/dd/yyyy")=%% returns: 06/09/2014

How do I parse/convert/format/concat it into "Monday, June 9, 2014"?


While FormatDate() can be limiting I commonly will return a full date as a variable and then use format for displaying the data. so first I grab the date @TheDateVar then FormatDate(V1,S1,S2,S3) which allows better but not unlimited flexibility for presentation.

Then SET @DateFormatted = FormatDate(@TheDateVar,"DDD, MMM DD, YYYY",S2,S3)

http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/utilities_ampscript_functions/#Format (then scroll a couple items down)


FormatDate supports all C# date formatting strings.

So, you will need to replace "MM/dd/yyyy" with "D", which is the C# symbol for the "long date"

See http://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx and http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx for the list of these strings.


Answer above provided by Timothy will produce a time stamp.

%%=FORMAT(DateAdd(Now(), "X","D"), "MMMM dd, yyyy")=%%

With X being how many days from now you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.