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

275
Views
How to convert date into unix time?

If I have a date that looks like this?

Sun, Nov 14, 2021 04:52:00PM

How can I convert this into unix time?

I did new Date('Sun, Nov 14, 2021 04:52:00PM') and .getTime() to it however i get returned NaN?

Is there a way of doing this moment or js?

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

0

With momentjs you can use the ddd, MMM DD, YYYY HH:mm:ss pattern:

const d = "Sun, Nov 14, 2021 04:52:00PM"

const parsed = moment('Sun, Nov 14, 2021 04:52:00PM',
                      'ddd, MMM DD, YYYY HH:mm:ss').toDate()
console.log(parsed)
console.log('unix:', parsed.getTime())
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js" integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>

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!