Home > Enterprise >  Getting readable date from ISO
Getting readable date from ISO

Time:03-04

I'm using vue.js and moment.js and I can't get this date into a readble format.

2022-03-16T13:00:00.000000Z

I'm looking for something like 16th March 2022 - 1pm

I've tried this thus far...

    var s = '2022-03-16T13:00:00.000000Z';
    var b = s.split(/\D /);
    console.log( new Date(Date.UTC(b[0], --b[1], b[2], b[3], b[4], b[5], b[6])));

and

<span>{{ '2022-03-16T13:00:00.000000Z' | moment("DD-MM-YY") }}</span>

CodePudding user response:

Using moment, you can achieve this-

moment('2022-03-16T13:00:00.000000Z').format('Do MMMM YYYY - h a') //16th March 2022 - 6 pm
  • Related