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

199
Views
How to implement setInterval() function with interval as Minutes

I got work like I need to call an API in the background every 28 minutes, So I thought of using setInterval to achieve this, but is it possible to set interval in minutes?

useEffect(() => {
setInterval(() => {
  //dispatch API here
},??)
})

Now here I need to run this every 28 minutes, How can I implement this?

If there are other possible ways to achieve my requirement also, please do recommend that way too.

Thanks in advance!!

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

0

setInterval accepts the delay parameter in milliseconds. A millisecond is 1 1000th (1/1000) of a second.

So if you want a delay of 28 minutes, you need to work out how many seconds this is (28*60) and then multiply that by 1000.

So 28 * 60 * 1000 = 1,680,000

https://developer.mozilla.org/en-US/docs/Web/API/setInterval

Richard.

about 4 years ago · Juan Pablo Isaza Report

0

setInterval accepts milliseconds, so you can calculate it to minutes:

useEffect(() => {
    const minutes = 28 * 60 * 1000;
    setInterval(() =>{
        console.log('hello world');
    }, minutes);
});
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!