getSecondsメソッド
getSecondsメソッドは
日付オブジェクト
に適用され、現在の秒数(0から59までの数値)を返します。
構文
日付.getSeconds();
例
現在の秒数を表示してみましょう:
let date = new Date();
let res = date.getSeconds();
console.log(res);
関連項目
-
時間を取得するメソッド
getHours -
分を取得するメソッド
getMinutes -
秒を取得するメソッド
getSeconds -
ミリ秒を取得するメソッド
getMilliseconds