15.9.1.12 MakeDay(year, month, date)

2010-07-19

long MakeDay(year:int|number, month::int|number, date:int|number)

Return a timestamp in milliseconds reflecting the date given. All arguments are coerced to int. NaN will be returned if any of them is infinite.

Note that the specification calls this function an operator.

Code: (Meta Ecma)
MakeDay = function(year, month, date){
if (!IsFinite(year) || !IsFinite(month) || !IsFinite(date)) return NaN;
var y = ToInteger(year);
var m = ToInteger(month);
var dt = ToInteger(dt);
var ym = y + Math.floor(m / 12);
var mn = m % 12;

// t is "find a value t such that YearFromTime(t) == ym and MonthFromTime(t) == mn and DateFromTime(t) == 1, if impossible return NaN"
return Day(t) + dt - 1;
}