console.log(json[0].aDate); //Mar 4 ,2022 10 30 PM
const date = new Date(json[0].aDate); // Date{NaN}
const date = moment(json[0].aDate).format('YYYY-MM-DD HH:mm:ss'); // Invailed Date
Is there any other way?
I’ve tried new Date()
, moment.js
and moment()
,format('YYYY-MM-DD HH:mm:ss')
but that doesn’t work.
I expect the following result:
console(date) //'2022-3-4 10:30:SS'