15.9.3 Date as constructor

2010-07-19

Date new Date(year:int|mixed, month:int|mixed[, date:int|mixed[, hours:int|mixed[, minutes:int|mixed[, seconds:int|mixed[, ms:int|mixed]]]]]])
Date new Date(timestamp:string)

The Date constructor is overloaded.

new Date(): If no arguments are given, the returned object will have a date value representing the current time (Date.now).

new Date(value): With one argument if that argument is a string, parse it exactly as Date.parse would do. Otherwise coerce the single argument to a number. The result will be the [[PrimitiveValue]] for the new date object.

new date(year,month,day,hour,min,sec,ms): With two or more arguments the [[PrimitiveValue]] of the new date object will be built up using the arguments. The month and year parameters are required to be able to distinct this overloaded version. All arguments are coerced to int.