0

i have a question regarding the format of DateTime variable pulled into an Marketing Cloud Content Builder Email from Sales Cloud using AMPscript. Note I am splitting out the date from the time.

I am able to change the format to the Locale that i need (DE) but when populating, it is pulling in some extra characters directly after the date and time, e.g "ae" or "aAe" and time section is not working

In Sales Cloud and Synchronized DE stored as: Wednesday, January 10, 2018 9:19 AM

Without any formatting it populates like this: 2018-01-10T09:09:19.000Z

I need it in German locale and date and time separated.

Current ampscript in content block:

%%=FormatDate(@date, "dd. MMMM. yyyy ", "date", "de-DE")=%%

%%=FormatDate(@date, "HH:mm ", "date", "de-DE")=%%

Current result:

10. Januar. 2018 10ae

09:01 AM 10aAe

Alternatively, I would prefer to set the format or formatdate in the Variable declaration in the header, but again not sure what is best.

  • As explained in @adamspriggs 's answer - inside the 'date' string you are placing in the time format section of FormatDate(), it is reading the 'd' and the 't' as format variables, but the 'a' and 'e' are showing as characters as there is no corresponding format variable using them. which is why you wind up with 11ae inside Date version and 'aAe' on Time version. 't' in time version is showing the first part of the 'AM/PM' formatting - hence the capital 'A' compared to just 11ae inside of the Date version. – Gortonington Jan 11 '18 at 13:26
1

Your date argument is not a valid format pattern. Here are the valid format ones for a date value of 2017-09-15T06:06:07.1230000-06:00:

+-----------------+----------------+-----------------------------------+
| Element         | Format Pattern | Output                            |
+-----------------+----------------+-----------------------------------+
| ISO             |       iso      | 2017-09-15T06:06:07.1230000-06:00 |
+-----------------+----------------+-----------------------------------+
| RFC-1123        |       rfc      | Fri, 15 Sep 2017 06:06:07 GMT     |
+-----------------+----------------+-----------------------------------+
| Long            |        l       | Friday, September 15, 2017        |
+-----------------+----------------+-----------------------------------+
| Short           |        s       | 9/15/2017                         |
+-----------------+----------------+-----------------------------------+
| Month, Year     |        Y       | September, 2017                   |
+-----------------+----------------+-----------------------------------+
| Year            |       YY       | 17                                |
+-----------------+----------------+-----------------------------------+
| Year            |      YYYY      | 2017                              |
+-----------------+----------------+-----------------------------------+
| Month           |        M       | September 15                      |
+-----------------+----------------+-----------------------------------+
| Month           |       MM       | 09                                |
+-----------------+----------------+-----------------------------------+
| Month           |       MMM      | Sep                               |
+-----------------+----------------+-----------------------------------+
| Month           |      MMMM      | September                         |
+-----------------+----------------+-----------------------------------+
| Day             |       dd       | 15                                |
+-----------------+----------------+-----------------------------------+
| Day             |      dddd      | Fri                               |
+-----------------+----------------+-----------------------------------+
| Day             |      ddddd     | Friday                            |
+-----------------+----------------+-----------------------------------+
| Hour            |       hh       | 06                                |
+-----------------+----------------+-----------------------------------+
| Minutes         |       mm       | 06                                |
+-----------------+----------------+-----------------------------------+
| Seconds         |       ss       | 07                                |
+-----------------+----------------+-----------------------------------+
| Milliseconds    |       MMM      | 123                               |
+-----------------+----------------+-----------------------------------+
| AM/PM           |       tt       | AM                                |
+-----------------+----------------+-----------------------------------+
| Timezone offset |       zz       | -06                               |
+-----------------+----------------+-----------------------------------+
| Timezone offset |       zzz      | -06:00                            |
+-----------------+----------------+-----------------------------------+

I'd also recommend using the format() function instead. You have more flexibility in the format string.

| improve this answer | |
1

Not an ideal solution but you can try by replacing "date" with " ":

%%=FormatDate(@date, "dd. MMMM. yyyy ", " ", "de-DE")=%%

%%=FormatDate(@date, "HH:mm ", " ", "de-DE")=%%

| improve this answer | |
  • thank you that worked! %%=FormatDate(@date, "dd. MMMM. yyyy ", "", "de-DE")=%% um %%=FormatDate(@date, "", "HH:mm ", "de-DE")=%% – Caroline R Jan 12 '18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.