How to set current date to midnight in Node.js

1 Answer

0 votes
const currentdate = new Date();

currentdate.setHours(0, 0, 0, 0);

console.log(currentdate.toString()); 
  
  
  
  
  
/*
run:
  
Sun Apr 10 2022 00:00:00 GMT+0000 (Coordinated Universal Time)
  
*/

 



answered Apr 10, 2022 by avibootz

Related questions

1 answer 118 views
1 answer 118 views
1 answer 97 views
1 answer 87 views
1 answer 134 views
...