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

161
Views
how do i show the amount of time elapsed from a certain date in html?

How would I make a "live" time counter in html? For example, I show the number of months, days, hours, minutes, and seconds that have passed since 1/1/2001 and I want to see it ticking upwards. How would I do that? I don't know JS lol, but I do remember once making the same thing but it displayed the time until a certain date using just one HTML file. I don't recall how I did it though.

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

0

You can use the below package

javascript-time-ago

// Load locale-specific relative date/time formatting rules.
import en from 'javascript-time-ago/locale/en'
 
// Add locale-specific relative date/time formatting rules.
TimeAgo.addLocale(en)
 
// Create relative date/time formatter.
const timeAgo = new TimeAgo('en-US')
 
timeAgo.format(new Date())
// "just now"
 
timeAgo.format(Date.now() - 60 * 1000)
// "a minute ago"
 
timeAgo.format(Date.now() - 2 * 60 * 60 * 1000)
// "2 hours ago"
 
timeAgo.format(Date.now() - 24 * 60 * 60 * 1000)
// "a day ago"
about 4 years ago · Juan Pablo Isaza Report

0

If you want one, go to this site. You can make a custom one with them. If you want to write one from scratch, go to their GitHub page and tune it to your liking.

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!