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 471 views
1 answer 158 views
1 answer 460 views
1 answer 87 views
1 answer 93 views
2 answers 134 views
...