Javascript examples for Date Operation:Date Calculation
Loop each hour to the same hour tomorrow
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w . ja va 2 s . c om var i; var date = new Date; var hours = date.getHours(); for(i = hours; i <= hours+24; i++) { if(i<25){ console.log(i); }else{ console.log(i-24); } } } </script> </head> <body> </body> </html>