I want to fetch date variable on a email in marketing cloud from a data extension that contains personalized dates. Also, when I preview the email, the date is displayed in the US format. I am looking to have the date displayed as dd mm yyyy (i.e in email the date should be 01 January 2018), how can I do this?
2 Answers
You can use date formatting function here.
%%[
VAR @date, @email
SET @email = EmailAddress /*This is the column name for email address that you have used in your DE*/
SET @date = Lookup('Data Extension name here','Date column name here that you have used in your Data Extension','Email Address column name here that you have used in your Data Extension',@email) /*To populate date value from your DE for the user to whom email will be sent*/
]%%
%%=FormatDate("@date", "DD MMMM YYYY")=%%
Please refer to this link for Date formatting function:
Please refer to this link for Lookup function:
-
Thank you Krati i will look up the links you gave me and try your solution.– MerlinCommented Nov 19, 2018 at 9:02
The date formatting function you provided is not returning any value when I go to preview my email send.
The below was used:
%%[
VAR @date, @email
SET @email = Email (Email is the column name for email address in my DE)
SET @date = Lookup('DE Name','Date column name','Email',@email)
]%%
%%=FormatDate("@date", "DD MMMM YYYY")=%%
?
-
did you replace
Email
andDate column name
with the correct attributes inside of your Data Extension? It sounds like your lookup is returning a null result. For instance, you could replaceEmail
withAttributeValue("emailaddr")
using the SFMC personalization string that pulls the associated sendable email address with that send. Commented Nov 19, 2018 at 13:50 -
Hi Yes I did, Email is "Email" in my data extension and date column was replaced with the attribute value using the personalisation string. I ended up uploading file in CRM as a text file, sync it to MC and using the personalisation in profile attribute as a workaround.– MerlinCommented Nov 26, 2018 at 4:53