Millisecond Equivalent of Time Interval


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //Gets the millisecond equivalent of an interval
  2. //Example: (2).seconds() == 2000
  3. Number.prototype.seconds = function(){ return this * 1000; };
  4. Number.prototype.minutes = function(){ return this * 60000; }; //60 * 1000
  5. Number.prototype.hours = function(){ return this * 3600000; }; //60 * 60 * 1000
  6. Number.prototype.days = function(){ return this * 86400000; }; //24 * 60 * 60 * 1000
  7. Number.prototype.weeks = function(){ return this * 604800000; }; //7 * 24 * 60 * 60 * 1000

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.