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

188
Views
How To campare date and check if is in future or past

i have a date formated as 3/13/2022 05:44 PM how to compare this date with the other dates which is formated in this manner and checks whether it is in past or future

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

0

Ohkay, so you need to compare the two dates and find which is latest, that is past or future..

So, you can just convert the dates to milliseconds using the Date.parse() function. This will parses a date string and returns the number of milliseconds since midnight January 1, 1970.

And then compare the two numbers accordingly.. For example:

<p id="demo"></p>

<script>
let ms = Date.parse("3/13/2022 05:47 PM");
let ns = Date.parse("3/13/2022 04:47 AM");
if(ms > ns){
document.getElementById("demo").innerHTML = "3/13/2022 05:47 PM is Future";
}else{
document.getElementById("demo").innerHTML = "3/13/2022 04:47 AM is Future";
}
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!