View Single Post
Old 11-01-2014, 12:40 PM  
CurrentlySober
Too lazy to wipe my ass
 
CurrentlySober's Avatar
 
Industry Role:
Join Date: Aug 2002
Location: A Public Bathroom
Posts: 38,531
Quote:
Originally Posted by SpotOnTechSupport View Post
Did a bit of searching and came up with this:

Code:
<script type="text/javascript">



function secondize(n)
{
if (n!=0) 
  {
  n= n / 1000;
  }
return n;
}



var timer = {
    init: function() {
        this.startTime = (new Date()).getTime();
        return this;
    },
    stop: function() {
        // returns time difference (in seconds: getSeconds()) between start time and time that this function was called

		var difference = new Date();
		var timeUsed=secondize(difference.setTime((new Date().getTime()) - this.startTime));


		return timeUsed;
    }
};
var count = timer.init();

</script>
Thanks mate. Whats daft, is I was trying to get a particular code to behave itself, and it wouldnt...

So I made this thread. Since then I have got it working!

But thanks anyway - All is good
__________________


👁️ 👍️ 💩
CurrentlySober is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote