Time-Service/js/clock.js

30 lines
1,023 B
JavaScript
Raw Normal View History

2018-05-08 18:33:24 +00:00
var offset = 49020000;
$(document).ready(function() {
// Create two variable with the names of the months and days in an array
2018-05-08 18:33:24 +00:00
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 timeTick() {
$('.point').css('animation-name', 'none');
var date = new Date();
date.setTime(date.getTime() - offset);
var seconds = date.getSeconds();
var minutes = date.getMinutes();
var hours = date.getHours();
$('#date').html(dayNames[date.getDay()] + " " + date.getDate() + ' ' + monthNames[date.getMonth()] + ' ' + date.getFullYear());
$("#sec").html(( seconds < 10 ? "0" : "" ) + seconds);
$("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
$("#hours").html(( hours < 10 ? "0" : "" ) + hours);
$('.point').css('animation-name', 'flash');
}
})