Return to Snippet

Revision: 8357
at September 16, 2008 15:20 by wizard04


Updated Code
//Gets the millisecond equivalent of an interval
//Example: (2).seconds() == 2000
Number.prototype.seconds = function(){ return this * 1000; };
Number.prototype.minutes = function(){ return this * 60000; };		//60 * 1000
Number.prototype.hours = function(){ return this * 3600000; };		//60 * 60 * 1000
Number.prototype.days = function(){ return this * 86400000; };		//24 * 60 * 60 * 1000
Number.prototype.weeks = function(){ return this * 604800000; };	//7 * 24 * 60 * 60 * 1000

Revision: 8356
at September 16, 2008 14:32 by wizard04


Initial Code
//Gets the millisecond equivalent of an interval
//Example: (2).seconds() == 2000
Number.prototype.seconds = function(){ return this * 1000; };
Number.prototype.minutes = function(){ return this * 60 * 1000; };
Number.prototype.hours = function(){ return this * 60 * 60 * 1000; };
Number.prototype.days = function(){ return this * 24 * 60 * 60 * 1000; };
Number.prototype.weeks = function(){ return this * 7 * 24 * 60 * 60 * 1000; };

Initial URL

                                

Initial Description

                                

Initial Title
Millisecond Equivalent of Time Interval

Initial Tags
javascript, number

Initial Language
JavaScript