Skip to content

Instantly share code, notes, and snippets.

@Rhyanz46
Created January 2, 2019 12:29
Show Gist options
  • Save Rhyanz46/4e8db3031bdd39e1a87c87563bb62d44 to your computer and use it in GitHub Desktop.
Save Rhyanz46/4e8db3031bdd39e1a87c87563bb62d44 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
<p><button onclick="myMove()">Click Me</button></p>
<div id="mulai"></div>
<div id ="animate"></div>
<script>
var minutes = 1000 * 60;
var hours = minutes * 60;
var days = hours * 24;
var years = days * 365;
var saat_program_mulai = new Date();
var saat_program_mulai = saat_program_mulai.getTime();
var saat_program_mulai = Math.round(saat_program_mulai / hours);
document.getElementById("mulai").innerHTML = "saat program di mulai " + saat_program_mulai;
function myMove() {
var elem = document.getElementById("animate");
var pos = 0;
var id = setInterval(frame, 5);
function frame() {
if (pos == 100000) {
clearInterval(id);
} else {
var now = new Date();
var now = now.getTime();
var saat_ini = Math.round(now / hours);
pos++;
if (saat_ini < hari_now) {
console.log("expired")
} else {
console.log("masih")
}
document.getElementById("animate").innerHTML = now;
}
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment