0

I am trying to use a single DateTime field from my data extension and use a formula to split into two clauses, one for date ('l' format, working fine) and one for "hh:mm am/pm" ('hh:mm tt' format) time.

Unfortunately it appears, at least within preview and the resulting test send, that my test record which is at 10:00 PM is appearing as "22:00 PM" which is obviously not desirable. I feel like I am missing something obvious but military/24-hour time is not documented in the developer guide as far as I can see.

The email recipient is from a Lead record, and the sending user's locale is set to "English (US)".

%%=FormatDate(Object__c:Date_Time__c, "l", "", "en-US")=%% %%=FormatDate(Object__c:Date_Time__c, "", "hh:mm tt", "en-US")=%%

and the resulting date/time:

result

I've tried h, hh, H, and HH and they all return the same format. Has anyone run into this before? Is there a format or setting I'm missing?

1

At the bottom of your link, there's something that reads "This example uses the "s" short token to format the time value 18:30 as a 12-hour clock value in the specified format:..." Have you tried that one to force the time back to 12-hour? https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/dateTimeFormatting.htm?search_text=24h

enter image description here

|improve this answer|||||
  • Sorry. Totally misread that. At the bottom of your link, there's something that reads "This example uses the "s" short token to format the time value 18:30 as a 12-hour clock value in the specified format:..." Have you tried that one to force the time back to 12-hour? – Harley May 31 '18 at 15:38
  • 1
    Well that's a revelation all in itself. I'm blown away that it is listed there without so much as a sub-heading! If you edit that into your answer I'll go ahead and accept. Thanks for pointing my eyes downward :P – JaredT May 31 '18 at 15:40
  • %%=FormatDate(Object__c:Date_Time__c, "", "s", "")=%% displays 10:00 PM perfectly. Thanks again! – JaredT May 31 '18 at 15:46

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.