For ergonomic questions and ease of reading, you may wish to change the display format of dates in emails when they come from a contact field.
By default, the display relies on the storage format in your DB (format used when importing contacts or by the API) : YYYY-MM-DD. Example for November 8th, 2000 it will be displayed in the format 2000-11-08.
Using Variables in Email
In the email, you have different complementary ways to use the variables to modify the display of a date.
-
{contactfield=DATEFIELDALIAS|datetime}
to display the date and time. -
{contactfield=DATEFIELDALIAS|date}
to display only the date. -
{contactfield=DATEFIELDALIAS|time}
to display only the time.
Your date will be displayed according to the settings made in the Configuration > System Settings interface, on the two following fields :
- Default format for date only
- Default Time Only Format
Using variable customization will give the following results instead of 2000-11-08 if you keep the default configuration:
-
{contactfield=DATEFIELDALIAS|datetime}
: November 8, 2000 12:00 am (12:00 am will be displayed if your field is a date type field and therefore does not contain a notion of time) -
{contactfield=DATEFIELDALIAS|date}
: November 8, 2000 -
{contactfield=DATEFIELDALIAS|time}
: 12:00 am
Customizing of the display format
In the fields Default format for date only & Default Time Only Format, you can change the display format. Here, you can fill the setting in PHP format according to the PHP official documentation.
By default, on your account, the values are as follows:
- Default format for date only: F j, Y. Example : November 8, 2000
- Default Time Only Format: g:i a. Example : 11:00 am
You can use an other format as you like (based on the PHP documentation shared above). For Default format for date only (and using {contactfield=DATEFIELDALIAS|date}
) for example:
- l j F Y: to display Wednesday 8 November 2000.
- d/m/o: to display 08/11/2000
Comments
0 comments
Please sign in to leave a comment.