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

247
Views
Why Does Date.parse gives 000 milliseconds?

const newDate = Date.now()
const newDate2 = new Date(newDate)
const newDate3 = Date.parse(newDate2)

console.log(newDate);
console.log(newDate2);
console.log(newDate3);

Results:

1638934575678

2021-12-08T03:36:15.678Z

1638934575000

Why does it give 000 milliseconds when it should be 678?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Date.parse - parse date from string. When you pass newDate parse method call .toString() from object and result will be output in format like this - Wed Dec 08 2021 16:37:43 GMT+0200 (Eastern European Standard Time). As you can see - there is no milliseconds. According to this in your case Date.parse not gives it.
You can fix it by using constructor Date(your second example). Or you can use method toISOString() that return milliseconds.

Date.parse(new Date().toISOString());
about 4 years ago · Juan Pablo Isaza Report

0

using method toISOString() worked for me to get the milliseconds

about 4 years ago · Juan Pablo Isaza Report
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!