Formatting dates in IBM Watson

You can include date and time personalization in mailings. Date personalization with time references assumes that you entered time-related information in GMT.

You can manually enter in date personalization fields and redefine the date format in the following areas:

  • Mailing body
  • Dynamic Content blocks with personalization inside DC content
  • Mailing body that contains external content
  • Relational Table personalization (RT and database fields)
  • SMS message body
  • Mailing Header fields
  • In Mailing Settings
  • Mailing_sent_date_iso
  • Mailing_sent_date
    • Date
    • Timestamp
    • Numeric
    • System Date
    • mailing_send_date
    • Segment/Send hour

Valid values for Month are (case-sensitive):

  • MMMM (for example, January)
  • MMM (for example, Jan)
  • M (for example, 1)

Valid values for Day are (case-sensitive):

  • dd (for example, 02)
  • d (for example, 2)

Valid values for Year are (case-sensitive):

  • yyyy (for example, 1999)
  • yy (for example, 99)

Examples:

  • 2014-02-28 HH:mm:ss (hour in a day 0 – 23)
  • 2014-02-28 hh:mm a (hour in am/pm)
  • 02-28-2014 HH:mm
  • 02-28-2014 HH:mm zzz (for example, GMT)
  • 02-28-2014 HH:mm zzzz (for example, Greenwich Mean Time)
  • 2014/07/24 12:00:00 AM
  • Jan 24, 2014 14:00
  • January 24, 2014 13:00:00

Valid numeric values – Supported characters are as follows:

  • 0 = A digit- always displayed
  • # = A digit, leading zeros are omitted
  • . = marks a decimal separator
  • , = marks a grouping separator (for example, thousand separator)
  • #,###.00 (for example, 1,000,00.63)

To show the dd/MMM/YYYY date format in the email, complete the following steps.

Procedure

  1. Open the contact’s Edit Contact page.
  2. In the Date Format String field, type “dd/MMM/YYYY”.
  3. Save the Edit Contact page.
  4. In the email body, type %%format(Birthday, DateFormatString)%%.
  5. Save the email.

Results

The two fields, Birthday and DateFormatString, are combined to show the birthday date as defined in the DateFormatString field: 10Oct1980.

Example

Important
The following options do not work in tandem with language or locale. Instead, you can create dynamic content to use this feature with a language or country data field.

In the following example, the following two fields are in the database:

  • A date field that is called Birthday. In this example, the field contains the value “10/10/1980”.
  • A text field that is called DateFormatString. This field defines the format of ANY date field.

The following examples show how to add literal formatting to the email body, by using the following format structure:

  • %%format([enter date field name],”[enter the combination of year, date, and month]”)%%
  • %%format([enter date field name],”yyyy”)%%
  • %%format(mailing_send_date,”yyyy”)%%
  • %%format([enter date field name]_ISO)%%

Use one of the following literal formats:

  • copyright%%format([enter date field name],”yyyy”)%%
  • ©%%format([enter date field name],”yyyy”)%%
  • %%format(mailing_send_date,”dd-MM-yyyy”)%%

Use the following option when you want to display a particular date format for an existing date database field in a mailing for all contacts who receive the mailing. To show the date format as yyyy-MMM-dd, do the following steps:

  1. Identify the date field, for example, “Birthday”.
  2. In the email body, type this literal format: %%format([enter date field name],”yyyy-MMM-dd”)%%
  3. Save the email.

For example, the Birthday field from your database reads as 10/10/1980. You can change the format to %%format(Birthday, “yyyy-MMM-dd”)%%. Now, all birthday dates shown in the mailing are in the yyyy-MMM-dd format.

Use this option when you want to display a certain format for a specific contact. For example, you might want to show someone’s birthday specific to the country they are living in, instead of how their birthday was entered into the Birthday field in the database.