date - javascript time ticker - Stack Overflow

I want to build a simple time ticker. Basically I will have a global javascript variable injected from

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 herehttp://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 badges
Add a ment  | 

3 Answers 3

Reset to default 2

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/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

相关推荐

  • date - javascript time ticker - Stack Overflow

    I want to build a simple time ticker. Basically I will have a global javascript variable injected from

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信