JavaScript | Date constructor Property
In JavaScript, The Date constructor property returns the constructor function for an object. For JavaScript Date constructor property returns function Date() { [native code] }.
Syntax:
Date.constructor
Example 1: This example uses constructor property and returns the date constructor function.
<!DOCTYPE html> <html> <head> <title> JavaScript | Date constructor Property </title> </head> <body> <center> <div style="background-color: green;"> <h1>Welcome to GeeksforGeeks!.</h1> <p> It returns the function that created the string's prototype: </p> <h1 id="demo"></h1> </div> </center> <script> var dy = new Date(); document.getElementById("demo").innerHTML = dy.constructor; </script> </body> </html> |
Output:

Example 2: This example uses constructor property and returns the date constructor function.
<!DOCTYPE html> <html> <head> <title> JavaScript | Date constructor Property </title> </head> <body> <center> <div style="background-color: white;"> <h1>Welcome to GeeksforGeeks!.</h1> <h3> It returns the function that created the string's prototype: </h3> <p id="name" style="background-color:green;"> </p> </div> </center> <script> var dy = new Date(); document.getElementById("name").innerHTML = dy.constructor; </script> </body> </html> |
Output:

Supported Browsers: The browsers supported by JavaScript Date constructor Property are listed below:
- Google Chrome
- Interent Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- JavaScript | Number constructor Property
- JavaScript | Boolean constructor Property
- JavaScript | String constructor Property
- JavaScript | Array constructor Property
- JavaScript | Date.prototype property
- JavaScript | RegExp constructor
- JavaScript | Array prototype Constructor
- JavaScript | Date
- JavaScript | Date.now()
- Date.UTC( ) In JavaScript
- Increment a given date in JavaScript
- JavaScript | date.setUTCMonth()
- JavaScript | date.toLocaleString()
- JavaScript | Date Formats
- JavaScript | Set Date Methods
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



