Date.prototype.getSeconds()
試してみましょう
getSeconds()
メソッドは、地方時に基づき、指定した日時の「秒」を返します。
構文
dateObj.getSeconds()
返値
地方時に基づき、与えた日付の「秒」を表す 0 から 59 までの間の整数値。
例
getSeconds() の使用
以下の 2 行目の文は、Date
オブジェクト Xmas95
の値に基づき、変数 seconds
に 30 という値を代入します。
var Xmas95 = new Date('December 25, 1995 23:15:30');
var seconds = Xmas95.getSeconds();
console.log(seconds); // 30
仕様書
ブラウザーの互換性
BCD tables only load in the browser