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

424
Views
.setHours(0,0,0,0) with moment.js

What is the easiest equivalent of date.setHours(0,0,0,0) when using moment.js?

Basically, if I need a new Date() moment with hours, minutes, seconds, and milliseconds zeroed out.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Start of Time

moment().startOf('day')
over 4 years ago · Santiago Trujillo Report

0

Suppose date is the moment object which contains the date having some hours and minutes.

You can use the following code to reset hours, minutes and seconds to 0.

date.utcOffset(0);
date.set({
 hour: 0,
 minute: 0,
 second: 0,
 millisecond: 0,
});
over 4 years ago · Santiago Trujillo Report

0

to set second for example to " 0 " time = moment().second(0);

over 4 years ago · Santiago Trujillo 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!