Search code examples
javascriptdatetimeticker

javascript time ticker


I want to build a simple time ticker.

Basically I will have a global javascript variable injected from the server side that will represent in my business model a active task start time for an agent.

I want to show in a tag the digital time format between that global that date and now, but the issue I have is with the milliseconds from the difference between those 2 dates.

I have created a JSFiddle but the difference between new Date() and that specific date is not showing properly.

enter code herehttp://jsfiddle.net/alexpeta/ZmzDh/3/

Can you guys spot the bug or the issue?


Solution

  • d.toLocaleString() might have a word with you ;) tip: no, you are not measuring time since September 22, you are measuring time to October 22.

    http://jsfiddle.net/LDKh7/