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

209
Views
Turning an input (amount of seconds) into an HH:MM:SS format for from API

I am currently using an API system to return the amount of time that someone has beaten a certain game in Hypixel (Minecraft). This API system returns the time in seconds and it would be much more convenient for it to be in the HH:MM:SS format. Based on some math I have come up with this:

const player = {
  stats: {
    arcade: {
      zombies: {
        overall: {
          fastestRound30: 2214
        }
      }
    }
  }
}

function zombieMath() {

  seconds = player.stats.arcade.zombies.overall.fastestRound30
  splice = seconds / 3600
  full_hours = Math.floor(splice)
  minutes = seconds - full_hours * 60
  full_minutes = Math.floor(minutes)
  remaining_seconds = minutes - full_minutes * 60

  return `${full_hours}:${full_minutes}:${remaining_seconds}`
}

console.log(zombieMath())

I don't fully understand this math, but it has to do with splicing the amount of full hours and minutes and multiply the rest with the remaining seconds. Although the console says something else : Fastest Round 30: 0:2152:-126968

How would I fix this problem? For reference I was trying to output 2,214 to HH:MM:SS format which is just under 37 minutes

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!