<p id="now"></p>
<p id="set"></p>
<p id="success"></p>
<script>
function now() {
const date = new Date();
const d = date.getDate();
const m = date.getMonth();
const y = date.getFullYear();
const h = date.getHours();
const mn = date.getMinutes();
const s = date.getSeconds();
const nd = new Date(Date.UTC(y, m, d, h, mn, s));
return nd.toLocaleString('id-ID', { timeZone: 'UTC' });
}
function setTime() {
const date = new Date('August 19, 1975 23:15:30');;
const d = date.setDate(30);
const m = date.setMonth(6);
const y = date.setFullYear(2023);
const h = date.setHours(15);
const mn = date.setMinutes(8);
const s = date.setSeconds(1);
const nd = new Date(Date.UTC(date.getFullYear(y), date.getMonth(m), date.getDate(d), date.getHours(h), date.getMinutes(mn), date.getSeconds(s)));
return nd.toLocaleString('id-ID', { timeZone: 'UTC' });
}
window.addEventListener("load", () => {
var text = "";
document.getElementById("set").innerText = setTime();
setInterval(function () {
document.getElementById("now").innerText = now();
if (now() >= setTime()) {
text = "OKE BRO";
document.getElementById("success").innerHTML = text
//disesuaikan dengan suara yang di inginkan
}else{
text = "GAGAL BRO";
document.getElementById("success").innerHTML = text
}
}, 500);
if (!navigator.getAutoplayPolicy) {
console.log("navigator.getAutoplayPolicy() not supported.");
} else {
console.log("navigator.getAutoplayPolicy() is supported.");
}
})
</script>
No comments:
Post a Comment