updatetime.js 1.98 KB
//JS function to update the time every minute
function updateTime(){

var d = new Date();
var hour= d.getHours();
var minute=d.getMinutes();
var day=d.getDay();
var month=d.getMonth();
var month_number=d.getMonth();
var year=d.getFullYear();
var second=d.getSeconds();
var datum=d.getDate();
document.getElementById("hour").innerHTML = hour;

var min;
if(minute==0){min="00"}
else if(minute==1){min="01";}
else if(minute==2){min="02";}
else if(minute==3){min="03";}
else if(minute==4){min="04";}
else if(minute==5){min="05";}
else if(minute==6){min="06";}
else if(minute==7){min="07";}
else if(minute==8){min="08";}
else if(minute==9){min="09";} 
else min=minute;
document.getElementById("minute").innerHTML = min;

var stunde;
if(hour==0){stunde="00"}
else if(hour==1){stunde="01";}
else if(hour==2){stunde="02";}
else if(hour==3){stunde="03";}
else if(hour==4){stunde="04";}
else if(hour==5){stunde="05";}
else if(hour==6){stunde="06";}
else if(hour==7){stunde="07";}
else if(hour==8){stunde="08";}
else if(hour==9){stunde="09";} 
else stunde=hour;
document.getElementById("hour").innerHTML = stunde;


var tag;
if(day==1){tag="Montag";}
else if(day==2){tag="Dienstag";}
else if(day==3){tag="Mittwoch";}
else if(day==4){tag="Donnerstag";}
else if(day==5){tag="Freitag";}
else if(day==6){tag="Samstag";}
else {tag="Sonntag";}
document.getElementById("day").innerHTML = tag;

var monat;
if (month==0){monat="Jan";}
else if (month==1){monat="Feb";}
else if (month==2){monat="Mär";}
else if (month==3){monat="Apr";}
else if (month==4){monat="Mai";}
else if (month==5){monat="Jun";}
else if (month==6){monat="Jul";}
else if (month==7){monat="Aug";}
else if (month==8){monat="Sep";}
else if (month==9){monat="Okt";}
else if (month==10){monat="Nov";}
else {monat="Dez";}
document.getElementById("month").innerHTML = monat;

document.getElementById("datum").innerHTML = datum; 


 

setTimeout(updateTime, 1000);
};

updateTime(); 

$("#menu-toggle").click(function(e) {
	e.preventDefault();
	$("#wrapper").toggleClass("toggled");
	});