Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how convert 13-04-2023 to MMM Do YYYY in javascript?

I need to convert 13-04-2023 to MMM Do YYYY in javascript

moment(ResData.mDate).format("MMM Do YYYY")

I tried like above. But it gives output as Oct 14th 0018.how I fix this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This is working:

const o = moment("13-04-2023", "DD-MM-YYYY");
const s = o.format("MMM Do YYYY");
console.log(s); //=> Apr 13th 2023
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading