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 583 views
1 answer 241 views
1 answer 597 views
1 answer 181 views
1 answer 188 views
2 answers 268 views
...