constructor Property (Date)

Specifies the function that creates a date.




The required date is the name of a date object.

The constructor property is a member of the prototype of every object that has a prototype. The constructor property contains a reference to the function that constructs instances of that particular object.


The following example illustrates the use of the constructor property.

var x = new Date("Hi");  

if (x.constructor == Date)  
    document.write("Object is a date.");  

// Output:  
// Object is a date.  


Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.