Moment.js Include text in middle of date format

JavascriptMomentjs

Javascript Problem Overview


I have a format of "Jan. 27, 2015 at 8:17 AM" that I need to display using moment.js. I'm using the format

moment.format('MMM. D, YYYY at h:mm A z');

Everything works great except for the word "at". How can I get that word to display as a word instead of the "a" in "at" being translated to the "am/pm". Right now using that date format it ends up looking like this: Jan. 27, 2015 amt 8:17 AM. Notice the "amt" instead of "at".

Is there any simple way of getting it to not process the "a" as part of the format? I have already tried splitting the output and manually entering the "at" after the third space but I'd like a cleaner code if possible.

Javascript Solutions


Solution 1 - Javascript

Escape it with square braces

moment().format('MMM. D, YYYY [at] h:mm A z');
// produces:    "Jan. 30, 2015 at 2:46 PM "

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBlueCaretView Question on Stackoverflow
Solution 1 - JavascriptDanielSTView Answer on Stackoverflow