Formatting Data in Email Templates

All form components pass data to email templates in a standard format. However some form components, such as the Date Field, have multiple formats available for use in the email template.

If you are using the Store and Mail Content form option and the Date Field component, you can choose to return only the date or only the time in the email template. By default, the Date Field component will return the date as a long string, e.g., February 25, 2014 at 03:00 PM.

Please familiarize yourself with creating a form and sending a confirmation and notification before continuing.

How to change the data format for the Date Field component

After creating the form and email template, the data format for the Date Field component can be changed. To change the standard format in the email template, the Date Field's variable name must be edited.

For the date only format, enter "date" before the Date Field variable name, e.g., ${date start-date}.

For the time only format, enter "time" before the Date Field variable name, e.g., ${time start-date}.

The final email template should look similar to the example below:

From: "${name}" <${email}>
To: kipling@sfu.ca
Subject: Form Owner Email Notification

Name: ${name}
Email: ${email}
Date: ${date start-date}

Date Field format reference table

When creating an email template, replace "date-field-name" with the name of your Date Field component.

Format

Variable

Output example

Default

${date-field-name}

February 25, 2014 at 03:00 PM

Date Only

${date date-field-name}

February 25, 2014

Time Only

${time date-field-name}

03:00 PM