めも

function waitUntilNextHalfHour() {

const now = new Date();

const minutes = now.getMinutes();

const timeToWait = (30 - (minutes % 30)) * 60 * 1000; // 現在時刻から最も近い0分または30分までのミリ秒数

setTimeout(() => {

// このコールバック関数が実行されるときは、0分または30分になったときです

// ここに、待機後に実行したいコードを記述します

}, timeToWait);

}

Reply to this note

Please Login to reply.

Discussion

No replies yet.