Just a quick tip since I didn’t find this to be well documented anywhere and someone else probably has this exact same problem. Frequently, I display time and date on a page. I used to do it like so:
#dateFormat(now(),'dddd, mmmm d, yyyy')# at #timeFormat(now(),'h:mm tt')#
…but why use two functions when you can use one, right? So I tried using the following:
#dateTimeFormat(now(),'dddd, mmmm d, yyyy at h:mm tt')#
But got briefly stuck when the ‘t’ in the date mask was getting translated to “apm” instead of the literal “at”. I said to myself, “Self… you need to escape those literal characters.” I came up with this:
#dateTimeFormat(now(),'dddd, mmmm d, yyyy "at" h:mm tt')#
But received the same result. As it turns out, in this case, double quotes and single quotes are important. The quick tip here is: escaping literal characters in a dateTimeFormat() mask requires the use of double quotes outside the mask and single quotes to escape your literal characters.
The winner was the following:
#dateTimeFormat(now(),"dddd, mmmm d, yyyy 'at' h:mm tt")#
Hi David,
Nice find! Filed https://tracker.adobe.com/#/view/CF-4203797 giving you credit.
Thanks!,
-Aaron
Mark; This does not work under ACF at least.
You must be logged in to post a comment.