JavaScript日付getHours

時(0〜23)を返します。

構文

date.getHours()

使用例

下記の値を入力するとサンプルに即時反映されます。

const
new
console
getHours
const date = new Date();
console.log(date.getHours());   // current hour (0-23)