codekasten/tycker/example-output-style/clock.js
phil 172437d378 simple javascript clock for frontend
remove table from administration backend, styling with bootstrap for mobile compability
2015-04-27 12:59:45 +00:00

19 lines
689 B
JavaScript

tday=new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
tmonth=new Array("Januar","Februar","M%E4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");
function GetClock(){
var d=new Date();
var nday=d.getDay(),nmonth=d.getMonth(),ndate=d.getDate(),nyear=d.getYear(),nhour=d.getHours(),nmin=d.getMinutes(),nsec=d.getSeconds();
if(nyear<1000) nyear+=1900;
if(nmin<=9) nmin="0"+nmin;
if(nsec<=9) nsec="0"+nsec;
document.getElementById('clockbox').innerHTML=""+tday[nday]+", "+ndate+". "+tmonth[nmonth]+" "+nyear+" <br/>"+nhour+":"+nmin+":"+nsec+"";
}
window.onload=function(){
GetClock();
setInterval(GetClock,1000);
}