JavaScript で秒単位のタイムスタンプを取得する
// 現在の時刻を取得 const now = new Date(); // ミリ秒単位のタイムスタンプを取得 const timestampInMilliseconds = now.getTime(); // 秒単位のタイムスタンプを取得 const timestampInSeconds = Math.floor(timestampInMilliseconds / 1000); console.log(timestampInSeconds);