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 here
/
Can you guys spot the bug or the issue?
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 here
http://jsfiddle/alexpeta/ZmzDh/3/
Can you guys spot the bug or the issue?
Share Improve this question edited Mar 16, 2015 at 15:02 Obito 3893 silver badges8 bronze badges asked Sep 22, 2011 at 14:25 Alex PetaAlex Peta 1,4051 gold badge15 silver badges27 bronze badges3 Answers
Reset to default 2d.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/LDKh7/
Example
Replace:
var t = setInterval('tick()',1000);
with:
var t = setInterval(tick,1000);
It's always a good idea to use function reference and not a string in setInterval
<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://scripts.hashemian./js/countdown.js"></script>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745329951a4622830.html
评论列表(0条)