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

377
Views
JS how to add hours and minutes to scheduled date

I need to be able to let clients schedule a certain type of meeting for a future date, the meeting duration I get back from the database is in minutes. I need to be able to create a future start date and time, then add the duration minutes to that time and get the end date and time. Then convert those two to utc time and iso format to send to backend. I know how to convert to utc and iso, just not sure of the best way to add times with the duration being in minutes. Any one know the best way to do this with javascripts date api, moment.js or another library?

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

0

I like to approach problems with time using the date-fns library. Today the Date object solves "most" of our problems so date-fns helps giving useful functions to manipulate dates.

What you might be looking for is the add minutes function. Also the formatISO might help.

For UTC, the UTC method should work fine.

about 4 years ago · Juan Pablo Isaza Report

0

With the Date API, you can:

// hours
date.setHours(date.getHours() + someHours);
// minutes
date.setMinutes(date.getMinutes() + someMinutes);
// whatever else...
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!