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

295
Views
Difference between date in JavaScript: How many hours between new Date() and new Date(unix_time_stamp)

I have the following coming response from the database:

{
  "createdAt": "1634413505432"
}

I want to convert this timestamp to something like 1 hour ago, 7 sec ago, 2 weeks ago based on the current date (new Date()). So I've tried to get the difference between the two dates but seems not working. maybe i'm doing it wrong.

Date.now() - 1634414179357 # i get 370517

new Date(370517 * 1000).getHours() # i get 8 which is wrong 

Can someone show me how to do this.

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!