-
-
Save Flybel/7b5cc4fb00aaeb08317d4cc7418a6e3b to your computer and use it in GitHub Desktop.
OBS Studio: A HTML page for showing current date and time in the video
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 charset="UTF-8"> | |
<title>A simple clock</title> | |
</head> | |
<body translate="no" > | |
<div id="output"></div> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script> | |
<script> | |
// https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript | |
var urlParams; | |
(function () { | |
var match, | |
pl = /\+/g, // Regex for replacing addition symbol with a space | |
search = /([^&=]+)=?([^&]*)/g, | |
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, | |
query = window.location.search.substring(1); | |
urlParams = {}; | |
while (match = search.exec(query)) | |
urlParams[decode(match[1])] = decode(match[2]); | |
})(); | |
var output = document.getElementById("output"); | |
if (urlParams["style"]) output.setAttribute("style", urlParams["style"]); | |
if (urlParams["bodyStyle"]) document.body.setAttribute("style", urlParams["bodyStyle"]); | |
var c; | |
setInterval( | |
c = function() { | |
output.innerText = moment().utc().format(urlParams["format"] || ''); | |
}, 1000); | |
c(); | |
</script> | |
</body> | |
</html> |
Any way you could do up one to output to EST? I've got people who want to use this but need the broadcasted time to be at EST.
NM, I figured it out. Thanks for this!
Rawgit will be shutting down soon. Here's another link to use:
https://gistcdn.githack.com/Flybel/7b5cc4fb00aaeb08317d4cc7418a6e3b/raw/a920c103cd3c90c4a11ce51a623d2c6200980df4/clock.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Outputs UTC time instead of local time, for the ones who need it.
Example link:
https://cdn.rawgit.com/Flybel/7b5cc4fb00aaeb08317d4cc7418a6e3b/raw/a920c103cd3c90c4a11ce51a623d2c6200980df4/clock.html?style=font:%20bold%2030px%20monospace;%20color:%20lightgray;%20display:%20inline-block;%20border-radius:%205px;%20padding:%202px%205px;%20background-color:%20rgba(0,%200,%200,%200.5)&format=YYYY-MM-DD%20HH:mm:ss%20UTC
Enjoy, I don't deserve any credit here