Created
April 8, 2017 08:11
-
-
Save scorpiorooster/b37075d1577e56492b445dd61c88d504 to your computer and use it in GitHub Desktop.
clock1 // source http://jsbin.com/gohajum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="clock1"> | |
<style type="text/css"> | |
body { | |
color: #77F913; | |
background-color: black } | |
</style> | |
<span id="nowHereText"></span></p> | |
<span id="LongDateText"></span></p> | |
<span id="LongTimeText"></span></p> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function startClock() { | |
var nowHere = new Date(); | |
locale = "en-US"; | |
month = nowHere.toLocaleString(locale, { | |
month: "long" | |
}); | |
weekday = nowHere.toLocaleString(locale, { | |
weekday: "long" | |
}); | |
day = nowHere.toLocaleString(locale, { | |
day: "numeric" | |
}); | |
year = nowHere.toLocaleString(locale, { | |
year: "numeric" | |
}); | |
//var tzoh = nowHere.getTimezoneOffset() / 60; | |
var h = nowHere.getHours(); | |
var m = nowHere.getMinutes(); | |
var s = nowHere.getSeconds(); | |
var ms = nowHere.getMilliseconds(); | |
h = checkTime(h); | |
m = checkTime(m); | |
s = checkTime(s); | |
//ms = checkTime(ms); | |
ms = fixms(ms); | |
//ms = checkTime(ms); | |
document.getElementById('nowHereText').innerHTML = nowHere | |
document.getElementById('LongDateText').innerHTML = "DATE: " + weekday + ", " + month + " " + day + ", " + year | |
document.getElementById('LongTimeText').innerHTML = "TIME: " + h + ":" + m + ":" + s + ":" + ms | |
//figure out next how to output more than one document? | |
var t = setTimeout(startClock, 1); | |
} | |
function checkTime(i) { | |
if (i < 10) { | |
i = "0" + i | |
}; // add zero in front of numbers < 10 | |
return i; | |
} | |
function fixms(i) { | |
if (i < 100) { | |
i = "0" + i | |
}; // add zero in front of numbers < 100 | |
return i; | |
} | |
startClock() | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function startClock() { | |
var nowHere = new Date(); | |
locale = "en-US"; | |
month = nowHere.toLocaleString(locale, { | |
month: "long" | |
}); | |
weekday = nowHere.toLocaleString(locale, { | |
weekday: "long" | |
}); | |
day = nowHere.toLocaleString(locale, { | |
day: "numeric" | |
}); | |
year = nowHere.toLocaleString(locale, { | |
year: "numeric" | |
}); | |
//var tzoh = nowHere.getTimezoneOffset() / 60; | |
var h = nowHere.getHours(); | |
var m = nowHere.getMinutes(); | |
var s = nowHere.getSeconds(); | |
var ms = nowHere.getMilliseconds(); | |
h = checkTime(h); | |
m = checkTime(m); | |
s = checkTime(s); | |
//ms = checkTime(ms); | |
ms = fixms(ms); | |
//ms = checkTime(ms); | |
document.getElementById('nowHereText').innerHTML = nowHere | |
document.getElementById('LongDateText').innerHTML = "DATE: " + weekday + ", " + month + " " + day + ", " + year | |
document.getElementById('LongTimeText').innerHTML = "TIME: " + h + ":" + m + ":" + s + ":" + ms | |
//figure out next how to output more than one document? | |
var t = setTimeout(startClock, 1); | |
} | |
function checkTime(i) { | |
if (i < 10) { | |
i = "0" + i | |
}; // add zero in front of numbers < 10 | |
return i; | |
} | |
function fixms(i) { | |
if (i < 100) { | |
i = "0" + i | |
}; // add zero in front of numbers < 100 | |
return i; | |
} | |
startClock() | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function startClock() { | |
var nowHere = new Date(); | |
locale = "en-US"; | |
month = nowHere.toLocaleString(locale, { | |
month: "long" | |
}); | |
weekday = nowHere.toLocaleString(locale, { | |
weekday: "long" | |
}); | |
day = nowHere.toLocaleString(locale, { | |
day: "numeric" | |
}); | |
year = nowHere.toLocaleString(locale, { | |
year: "numeric" | |
}); | |
//var tzoh = nowHere.getTimezoneOffset() / 60; | |
var h = nowHere.getHours(); | |
var m = nowHere.getMinutes(); | |
var s = nowHere.getSeconds(); | |
var ms = nowHere.getMilliseconds(); | |
h = checkTime(h); | |
m = checkTime(m); | |
s = checkTime(s); | |
//ms = checkTime(ms); | |
ms = fixms(ms); | |
//ms = checkTime(ms); | |
document.getElementById('nowHereText').innerHTML = nowHere | |
document.getElementById('LongDateText').innerHTML = "DATE: " + weekday + ", " + month + " " + day + ", " + year | |
document.getElementById('LongTimeText').innerHTML = "TIME: " + h + ":" + m + ":" + s + ":" + ms | |
//figure out next how to output more than one document? | |
var t = setTimeout(startClock, 1); | |
} | |
function checkTime(i) { | |
if (i < 10) { | |
i = "0" + i | |
}; // add zero in front of numbers < 10 | |
return i; | |
} | |
function fixms(i) { | |
if (i < 100) { | |
i = "0" + i | |
}; // add zero in front of numbers < 100 | |
return i; | |
} | |
startClock() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment