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 470 views
1 answer 157 views
1 answer 457 views
1 answer 84 views
1 answer 88 views
2 answers 130 views
...