A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Date/getSeconds below:

Date.prototype.getSeconds() - JavaScript | MDN

Date.prototype.getSeconds()

Baseline Widely available

getSeconds() は Date インスタンスのメソッドで、地方時に基づき、指定した日時の「秒」を返します。

試してみましょう
const moonLanding = new Date("July 20, 69 00:20:18");

console.log(moonLanding.getSeconds());
// 予想される結果: 18
構文 引数

なし。

返値

地方時に基づき、指定された日時の「秒」を表す 0 から 59 までの間の整数値です。日時が無効な場合は NaN を返します。

例 getSeconds() の使用

変数 seconds には、 Date オブジェクト xmas95 に基づいて、 30 という値が入ります。

const xmas95 = new Date("1995-12-25T23:15:30");
const seconds = xmas95.getSeconds();

console.log(seconds); // 30
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4