Open In App
Related Articles

JavaScript Date constructor Property

Improve Article
Save Article
Like Article

JavaScript Date constructor property returns the constructor function for an object. It is an ES1 feature and is supported by all browsers. The function which is returned by this property is just the reference to this function, not a date containing the function’s name. The JavaScript date constructor, string constructor, and boolean constructor return function Date() { [native code] }., function String() { [native code] } and function Boolean() { [native code] } respectively.



Return value: function Date() { [native code] }.

The below example illustrates the JavaScript Date constructor Property:

Example 1:


let date = new Date();
console.log("Date.constructor:" + date.constructor);


Date.constructor:function Date() { [native code] }

Example 2: This example uses the constructor property and returns the date constructor function.  


<!DOCTYPE html>
<html lang="en">
    <title>JavaScript Date constructor Property</title>
<body style="text-align:center;">
        <h1 style="color: green;">GeeksforGeeks</h1>
            JavaScript Date constructor Property
            returns the function that created the
            Date's prototype:
        <b id="GFG"></b>
    <!-- Script to use date constructor -->
        let dy = new Date();
            = dy.constructor; 


Supported Browsers: The browsers supported by JavaScript Date constructor Property are listed below:  

  • Google Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer 8 and above
  • Opera 3 and above
  • Safari 1 and above

We have a complete list of Javascript Date Objects, to check those please go through this Javascript Date Object Complete referencearticle.

Last Updated : 19 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials