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 127 views
1 answer 123 views
1 answer 105 views
1 answer 95 views
1 answer 143 views
...