How to Specify Custom DateTime Placeholder Format in ClickDimensions for Dynamics 365

Paul Nieuwelaar, 09 November 2017

When adding DateTime fields into a ClickDimensions email template or email send for Microsoft Dynamics 365, you need to create a placeholder which looks something like this, just like with any other placeholder:


${Recipient.contact.createdon[0]!""}


The problem with this is that it displays in the default format, which for date and time fields is “M/d/yyyy h:mm tt”, or “1/9/2017 12:00 AM”. For date only fields this is just “M/d/yyyy”.


If we want to customize the format, e.g. to only display the date when using a date and time field, or if we just want to use a different format other than the default, we can specify this using the following placeholder:


${Recipient.contact.createdon?datetime("MM/dd/yyyy")?string("dd MMMM yyyy")}


Note that the format specified here: datetime("MM/dd/yyyy") depends on your region. For example US region format will be MM/dd/yyyy, but here in New Zealand for example, we need to specify it as dd/MM/yyyy. The easiest way to check this is to just run a test email send and print out the date field as usual to see how it’s being formatted (as MM/dd or dd/MM).


We can then adjust the string format to whatever we what. E.g. “dd MMMM yyyy” will display as “09 January 2017”. However, we can just use “d/MM/yyyy” if we want a date only format like “9/01/2017”.
 
  image

image