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

98
Views
moment() Get todays date with midnight

I am trying to query the database with all records which are starting from today and greater than midnight.

var dateTime = moment().toDate();

gives me the current date and time. But is there any way to set the midnight of today?

new Date(new Date().setHours(0, 0, 0, 0))

Tried the above but still it give me

2021-09-11T18:30:00.000Z
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

how about

moment().startOf('day').toString();

var now = moment().startOf('day').toString();
console.log(now);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

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!