Skip to content

Instantly share code, notes, and snippets.

@QVMaster
Created July 8, 2018 13:59
Show Gist options
  • Save QVMaster/43b40398c36c21148804c0083b979825 to your computer and use it in GitHub Desktop.
Save QVMaster/43b40398c36c21148804c0083b979825 to your computer and use it in GitHub Desktop.
JS Bin [add your bin description] // source https://jsbin.com/tilahog
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="timer"></div>
<script id="jsbin-javascript">
var input = {
year: 0,
month: 0,
day: 0,
hours: 0,
minutes: 0,
seconds: 30
};
var timestamp = new Date(input.year, input.month, input.day,
input.hours, input.minutes, input.seconds);
var interval = 1;
setInterval(function () {
timestamp = new Date(timestamp.getTime() + interval * 1000);
//document.getElementById('countdown2').innerHTML = timestamp.getDay() + 'd:' + timestamp.getHours() + 'h:' + timestamp.getMinutes() + 'm:' + timestamp.getSeconds() + 's';
document.getElementById('timer').innerHTML = timestamp.getHours() + ':' + timestamp.getMinutes() + ':' + timestamp.getSeconds();
}, Math.abs(interval) * 1000);
</script>
<script id="jsbin-source-javascript" type="text/javascript">var input = {
year: 0,
month: 0,
day: 0,
hours: 0,
minutes: 0,
seconds: 30
};
var timestamp = new Date(input.year, input.month, input.day,
input.hours, input.minutes, input.seconds);
var interval = 1;
setInterval(function () {
timestamp = new Date(timestamp.getTime() + interval * 1000);
//document.getElementById('countdown2').innerHTML = timestamp.getDay() + 'd:' + timestamp.getHours() + 'h:' + timestamp.getMinutes() + 'm:' + timestamp.getSeconds() + 's';
document.getElementById('timer').innerHTML = timestamp.getHours() + ':' + timestamp.getMinutes() + ':' + timestamp.getSeconds();
}, Math.abs(interval) * 1000);
</script></body>
</html>
var input = {
year: 0,
month: 0,
day: 0,
hours: 0,
minutes: 0,
seconds: 30
};
var timestamp = new Date(input.year, input.month, input.day,
input.hours, input.minutes, input.seconds);
var interval = 1;
setInterval(function () {
timestamp = new Date(timestamp.getTime() + interval * 1000);
//document.getElementById('countdown2').innerHTML = timestamp.getDay() + 'd:' + timestamp.getHours() + 'h:' + timestamp.getMinutes() + 'm:' + timestamp.getSeconds() + 's';
document.getElementById('timer').innerHTML = timestamp.getHours() + ':' + timestamp.getMinutes() + ':' + timestamp.getSeconds();
}, Math.abs(interval) * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment