How to get the hour from the current date in JavaScript

1 Answer

0 votes
const today = new Date();

const hour = today.getHours();
   
console.log(hour);
 
 
/*
run:
 
9
 
*/

 



answered May 30, 2016 by avibootz
edited Feb 27, 2025 by avibootz

Related questions

1 answer 474 views
1 answer 160 views
1 answer 463 views
1 answer 92 views
1 answer 95 views
2 answers 136 views
...