I have to display a date in UTC format after updating the year. i had 2 problems :
1 - the first and the second "console.log" display different formats, despite theyr have exactly the same logic.
2- the ".toUTCString()" method does not work
Can someone tell me why ?
Thanks.
let date = new Date();
date.setFullYear(2020);
console.log(date);
// 1- the next line does not display the same as the previous
console.log(new Date().setFullYear(2020));
console.log(date.toUTCString());
// 2- toUTCString() does not work
console.log(new Date().setFullYear(2020).toUTCString());