mirror of
https://github.com/fhem/fhem-mirror.git
synced 2024-11-22 02:59:49 +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:
parent
b700e84c34
commit
8d416232af
25
fhem/contrib/DOIF/doifclock.js
Normal file
25
fhem/contrib/DOIF/doifclock.js
Normal 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 + "  " + days[dofw] + " " + 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();
|
Loading…
Reference in New Issue
Block a user