15.9.1.11 MakeTime(hour, min, sec, ms)

2010-07-19

long MakeTime(hour:int|number, min:int|number, sec:int|number, ms:int|number)

Create a timestamp (in milliseconds) from given arguments. All arguments are coerced to integer. If any argument is infinite NaN will be returned.

Note that the specification calls this function an operator...

Code: (Meta Ecma)
MakeTime = function(hour, min, sec, ms){
if (!IsFinite(hour) || !IsFinite(min) || !IsFinite(sec) || !IsFinite(ms)) return NaN;
var h = ToInteger(hour);
var m = ToInteger(min);
var s = ToInteger(sec);
var milli = ToInteger(ms);
var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli;
return t;
}