1

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

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:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/dateTimeFormatting.htm

Please refer to this link for Lookup function:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/lookup.htm

| improve this answer | |
  • Thank you Krati i will look up the links you gave me and try your solution. – Vavan Nov 19 '18 at 9:02
1

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")=%%

?

| improve this answer | |
  • did you replace Email and Date 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 replace Email with AttributeValue("emailaddr") using the SFMC personalization string that pulls the associated sendable email address with that send. – Gortonington Nov 19 '18 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. – Vavan Nov 26 '18 at 4:53

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.