Skip to main content

2 minute read

If you are creating Online Actions or Targeted Email for supporters who are using international or other date formats, it's important to make sure your communications present the date in the format they are expecting. Reversing the month and day fields can lead to confusion and create an unnecessary barrier in your communications.

For most of the merge fields that are dates, the standard presentation of the date defaults to YYYY-MM-DD, such as 2019-11-08. But for supporters who are unfamiliar with this international standard, presenting dates in this way can create confusion.

You can use the format_date macro to change the format to make sure your supporters see the date in the way they expect.
 

Using the macro to format your date fields
 

This macro has four possible arguments: date value, format, length, language.
 
format_date(date value, format, length, language)
 
The date value can be a specific date (such as 2019-11-08), but more often you will use a date merge field such as:
  • {{SubmissionDate}}
  • {{RecurringEndDate}}
  • {{DOB}}
  • {{EventStartDate}}
  • {{EventEndDate}}

If you have a Custom Field merge field where type = date (ex: {{CFF_7973964966533499}}) you can add the format_date macro but it will not appear as a default option.

The format option lets you pick the order of display for the month, day, and year.
  • MDY → MM/DD/YYYY (short length)
  • DMY → DD/MM/YYYY (short length)
  • YMD → YYYY-MM-DD (short length)

You have three choices for length: short, medium, or long. For example (in MDY format):
  • Short gives you the numerical date only. (11/08/2019)
  • Medium displays the month in text form along with a numerical day and year. (November 8, 2019)
  • Long adds the name of the day of the week to the date. (Friday, November 8, 2019)
     
Language controls which language is used to display the month and weekday for the medium and long dates. If no language is specified, this defaults to US-English.
 
In total, there are nine different ways that the format_date macro can format a date (if no arguments are included, the output will default to the short length YMD format).

For example, if DOB =November 4, 1985, you can choose any of the following outputs:



 
Be the first to reply!