Formatting Dates in json
- Phillip Williams
- Jan 17, 2020
- 1 min read
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);
})
Comments