forked from Cliffbreak/Time-Service
31 lines
1 KiB
JavaScript
31 lines
1 KiB
JavaScript
const offset = 49020000;
|
|
|
|
$(document).ready(function() {
|
|
// Create two variable with the names of the months and days in an array
|
|
var monthNames = [ "Januar" , "Febuar" , "März" , "April" , "Mai" , "Juni" , "Juli" , "August" , "September" , "Oktober" , "November" , "Dezember" ];
|
|
var dayNames= [ "Sonntag" , "Montag" , "Dienstag" , "Mittwoch" , "Donnerstag" , "Freitag" , "Samstag" ];
|
|
|
|
timeTick();
|
|
setInterval(timeTick, 1000);
|
|
|
|
function twoDigits (n) {
|
|
return (n < 10 ? '0': '') + n;
|
|
}
|
|
|
|
function timeTick() {
|
|
$('.point').css('animation-name', 'none');
|
|
const date = new Date();
|
|
date.setTime(date.getTime() - offset);
|
|
|
|
const seconds = date.getSeconds();
|
|
const minutes = date.getMinutes();
|
|
const hours = date.getHours();
|
|
|
|
$('#date').html(dayNames[date.getDay()] + " " + date.getDate() + ' ' + monthNames[2] + ' ' + date.getFullYear());
|
|
$("#sec").html(twoDigits(seconds));
|
|
$("#min").html(twoDigits(minutes));
|
|
$("#hours").html(twoDigits(hours));
|
|
|
|
$('.point').css('animation-name', 'flash');
|
|
}
|
|
})
|