How to format date with momentjs?

I want to format Date: Aug 22nd 2022 (the most important is suffix nd) I cannot format with string. I found a library help me with this format is momentjs. How can I format with momentjs?



1 Reply 1 reply marked as answer

SP Sureshkumar P Syncfusion Team August 23, 2022 10:57 AM UTC

Hi Trung,

You can pass the date with string format inside the moment function.

Find the code example here:

moment("02/22/2022").format("MMM Do YY");

Find the output screenshot:

Find the sample in the attachment:

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,

Sureshkumar P


Attachment: sample_c02b1fed.zip

Marked as answer
Loader.
Up arrow icon