I've tried a few solutions from Stack Overflow but I cannot for the life of me figure out how to add comma separators to the counts as seen in this fiddle.
HTML
Today: <div id="count"></div><br/>
This Year: <div id="yearcount"></div>
Javascript
var div = document.getElementById('count');
var yeardiv = document.getElementById('yearcount');
function updateCount(wid) {
var d = new Date();
// set d to midnight
d.setHours(0,0,0,0);
var count = Math.floor( ( new Date().getTime() - d.getTime() ) / 8000 );
div.innerHTML = count;
var wid = count;
// set d to Jan 1st
d.setMonth( 0 );
d.setDate( 1 );
count = Math.floor( ( new Date().getTime() - d.getTime() ) / 8000 )
yeardiv.innerHTML = count;
}
updateCount();
setInterval( updateCount, 8000 );
Any help would be greatly appreciated, thank you all in advance!