MakeTime() (Time calculation)

A date and time algorithm.

Availability:

ECMAScript edition - 2
Property/method value type:Number primitive

The MakeTime() operator calculates a number of milliseconds from its four arguments. Each argument must be an ECMAScript number value.

All of the arguments must be numeric and finite values. The values should be integers. If they are not then the result will be NaN.

The constant time values giving milliseconds per hour, minute and second are used to multiply each argument. The results are then summed to provide an equivalent time in milliseconds.

No range checking is performed according to the ECMA standard so some degree of overflow can be expected.

Although this is called an operator in the standard, its behavior is more like that of a function. It is not part of the formal language implementation but is a useful function to have available and can be simulated by writing a script based function. It is documented in the standard to assist in the algorithmic breakdown of the Date method handlers.

The result is a time value since midnight measured in milliseconds.

See also:Cast operator, Date object, Date(), Date.UTC(), Time range, Time value

Cross-references:

ECMA 262 edition 2 - section - 15.9.1.11

ECMA 262 edition 3 - section - 15.9.1.11