Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Javascript : Dates are not dispalyed in the same format and the toUTCString does not work

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());

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!