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 211 views
1 answer 198 views
1 answer 216 views
1 answer 184 views
1 answer 229 views
...