top of page

Formatting Dates in json

const options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric' };

json.forEach(element=> {

let formattedDate =new Date (element.lastUpdated);

element.lastUpdated= formattedDate.toLocaleDateString("en-US",options);

})




21 views0 comments
bottom of page