getSecondsメソッド

getSecondsメソッドは 日付オブジェクト に適用され、現在の秒数(0から59までの数値)を返します。

構文

javascript日付.getSeconds();

例

現在の秒数を表示してみましょう:

javascriptlet date = new Date();
let res = date.getSeconds();

console.log(res);

関連項目