I am using MomentJS for converting the date format.
I have a date in this format 2010/12/01 and I want to convert it to 01/12/2010 using MomentJS only.
I have another date in this format "12/02/2014" and I want to convert in "2014/12/02"
<!--begin snippet: js hide: false console: true babel: false-->
<!--language: lang-js-->
var date = moment(new Date(2010/12/01)).format("MMM Do h/mm");
console.log(date);
<!--language: lang-html-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min.js"></script>
<!--end snippet-->
How do I convert them using MomentJS
You can try this:
moment('2010/12/01', 'YYYY/MM/DD').format('DD/MM/YYYY')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With