-1

this is part of a javascript file i have

setInterval(function(){ 
    if(!allowCountdown)return;
    var time = $('.time').text();
    time = time.slice(0,time.length-1);

    if(time > 0) {
        time -= .052;
        time = Math.floor(time * 1000) / 1000;
        if(time < 0)
            time = 0;
        time = time.toFixed(3);
        $('.time').text(time+'s');
    }
    else {

        //getCurTime();
    }
}, 52); 

It says that the function getCurTime(); is not vaild, do you have any idea why is it happening?

1 Answers1

0

I see that you wanna get the current time. But, there doesn't exist a function called getCurTime();. To get the current time, this is what you should do :

var foo=new Date(),
    time= foo.getTime();

Check out this to format the time.

Dhruv Ramani
  • 2,633
  • 2
  • 22
  • 29