2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2024-11-22 09:49:50 +00:00

doifclock.js: clock with date

git-svn-id: https://svn.fhem.de/fhem/trunk@20777 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Damian 2019-12-18 17:19:47 +00:00
parent b700e84c34
commit 8d416232af

View File

@ -0,0 +1,25 @@
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var d = today.getDate();
var mo = today.getMonth()+1;
var y = today.getFullYear();
var dofw =today.getDay();
var days = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'];
h = checkTime(h);
m = checkTime(m);
d = checkTime(d);
mo = checkTime(mo);
$('.doifclock').each(function(){
$(this).html(h + ":" + m + "&nbsp&nbsp" + days[dofw] + "&nbsp" + d + "." + mo + "." + y);
});
var t = setTimeout(startTime,1000);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
startTime();