Google Tag Manager

Forum Discussion

stella_issupow's avatar
stella_issupow
Active Member II
2 years ago

How to change the date format in an email using liquid

Hi everybody, greetings from Germany!

I want to display the date format of a custom property in an email in a different way.

In the propery, we save the date in this format: YYYY-MM-DD hh:mm:ss.

I'd like to display the property in the email in this format: DD.MM.YYYY

Does anybody know how I can achieve that?

Thanks so much for your support!

  • Hey Stella, 

    Try this:

    {{event_properties.${datepropertyname} | date: "%d.%m.%Y" }}

    It's the same syntax for custom attributes, just add "|" after the first closing curly bracket and define the format of the date attribute. 

  • Arso's avatar
    Arso
    Specialist

    Hey Stella, 

    Try this:

    {{event_properties.${datepropertyname} | date: "%d.%m.%Y" }}

    It's the same syntax for custom attributes, just add "|" after the first closing curly bracket and define the format of the date attribute. 

    • kppool's avatar
      kppool
      Active Member

      Does this work for custom attributes? I can't seem to make this set up work:
      {{custom_attribute.${next_club_delivery_date}|date:"%d.%m.%Y"}}

      • sparkplant's avatar
        sparkplant
        Active Member

        Hi kppool

        this  will work with custom attributes as well.
        Please make sure, that the field is recognized as a date-type in Braze: See Custom Attributes Data Types 

        You can take a look under Data Settings > Custom Attributes to see if Braze automatically detects the data type.

  • ML_Spain's avatar
    ML_Spain
    Active Member

    Ciao, Arso and DavidO need to bring this topic up again, as I'd like to know if this is possible also with api.trigger properties. Not sure about it 

    Thanks a lot 

    • Arso's avatar
      Arso
      Specialist

      You should be able to do it, if the api call is built properly. You need to have a trigger_properties object within the api call, where you can put all the properties that you want to use and reference in the communication. 

      Then, a simple {{ api_trigger_properties.${datepropertyname} | date: "%d.%m.%Y" }} would do the trick.