Include text in the middle of Date format with Moment.js

In this short article, we will show you how to include text in the middle of Date format with Moment.js. Refer to the list of articles that are based on the Moment.js.

Let’s assume that we need to use moment.js to display a date in the format Jan. 26, 2022 at 9:17 AM. This is the format we usually use.

Except for the term at, everything works well. How can we make that word appear as a word rather than the a in at being converted to am/pm? Using that date format, it now looks like this: Jan. 26, 2022 amt 9:17 AM. The amt is used instead of at.


Using the Moment JS we can Escape the word with square braces. Look at the following syntax to get the desired output.

That’s it for today.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *