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

174
Views
Javascript date to timestamp

I know there are numerous ways to go about this, but I'm dealing with date formatted as such:

"2021-01-06T16:24:34Z"

How do I convert this to a timestamp that represent post unix epoch with Javascript?

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

0

You just need to parse the date, then divide the resulting number by 1000 to have it in seconds.

To parse it, you just need to remove the T and the Z.

let dateString = "2021-01-06T16:24:34Z";

let dateForDateParsing = dateString.replace("T", " ").replace("Z", "");
console.log(dateForDateParsing);

let UnixTimestamp = Math.floor(new Date(dateForDateParsing) / 1000);
console.log(UnixTimestamp);

about 4 years ago · Juan Pablo Isaza Report

0

new Date("2021-01-06T16:24:34Z").getTime() / 1000
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!