I am new in JS and dates world. I have this string date here
12/22/2020, 1:14:09 PM
How can i convert it so at the end i would have
Tuesday, 12/22, 01:14 AM
or
Tuesday, 12/22, 01:14 PM
dynamically AM and PM
I am new in JS and dates world. I have this string date here
12/22/2020, 1:14:09 PM
How can i convert it so at the end i would have
Tuesday, 12/22, 01:14 AM
or
Tuesday, 12/22, 01:14 PM
dynamically AM and PM
The official docs here are plentiful, but here's a solution anyway:
const src = '12/22/2020, 1:14:09 PM';
const dest = moment(src, 'MM/DD/YYYY, h:mm:ss A').format('dddd, MM/DD, hh:mm A');
console.log(dest); /* Gives Tuesday, 12/22, 01:14 PM */
That should work for you, assuming you've got moment.js
loaded.