How can I change date format received from a API when a date comes in UTC format so that the date will be day/month/year?
fetch('https://api.spacexdata.com/v3/launches/next')
.then(result => result.json())
.then((res) => {
console.log(res.launch_date_local);
})
Looks like I found the solution to this, thanks to all that posted, but this works for me:
fetch('https://api.spacexdata.com/v3/launches/next')
.then(result => result.json())
.then((res) => {
(res.launch_date_local);
const date = Date.parse(res.launch_date_local);
console.log(new Intl.DateTimeFormat('en-GB').format(date));
});