I am having trouble adding in a year to my count up code.
I have tried this:
days=Math.floor(difference/(60*60*1000*24)*1);
days=Math.floor(difference/(60*60*1000*24)*1/365);
hours=Math.floor((difference%(60*60*1000*24))/(60*60*1000)*1/365);
mins=Math.floor(((difference%(60*60*1000*24))%(60*60*1000))/(60*1000)*1/365);
secs=Math.floor((((difference%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1/365);
document.getElementById('countup').setAttribute("uptime",years+':'days+':'+hours+':'+mins+':'+secs)
document.getElementById('years').firstChild.nodeValue = years;
document.getElementById('days').firstChild.nodeValue = days;
document.getElementById('hours').firstChild.nodeValue = hours;
document.getElementById('minutes').firstChild.nodeValue = mins;
document.getElementById('seconds').firstChild.nodeValue = secs;
But it still didn't work. Also how would I allow for a leap year?
Working fiddle without year below:
https://jsfiddle.net/ma9ic/3jxm4e7t/
Can someone point me in the right direction. Is there an easier method for creating the same effect with jQuery?