🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › Date
Date() constructor - JavaScript | MDN
The Date() constructor creates Date objects. When called as a function, it returns a string representing the current time.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
In essence, the timezone offset is the offset from UTC time, at the time represented by the Date object and at the location of the host environment. There are two groups of Date methods: one group gets and sets various date components by interpreting the timestamp as a local time, while the other uses UTC. The Date() constructor can be called with two or more arguments, in which case they are interpreted as the year, month, day, hour, minute, second, and millisecond, respectively, in local time.
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
By default, JavaScript will use the browser's time zone and display a date as a full text string: You will learn much more about how to display dates, later in this tutorial. Date objects are created with the new Date() constructor.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-constructor
JavaScript Date() Constructor - GeeksforGeeks
July 23, 2025 - The date object can be created with or without any parameter · val: This is the value of date in Integer format representing the time in milliseconds since Jan,1,1970 · DateStr: This is the date in String format valid in Date.parse() method.
🌐
W3Schools
w3schools.com › jsref › jsref_constructor_date.asp
Javascript Date constructor Property
cssText getPropertyPriority() getPropertyValue() item() length parentRule removeProperty() setProperty() JS Conversion · ❮ Previous JavaScript Date Reference Next ❯ · Get the Date constructor: const d = new Date(); let text = d.constructor; ...
🌐
Talent500
talent500.com › blog › javascript-date-object-methods-time-zones
JavaScript Date Object: Methods, Time Zones & Usage Guide
June 17, 2025 - ... In the example above, timestamp` ... 00:00:00 UTC). The new Date() constructor takes this timestamp as an argument and creates a Date object that represents the date and time corresponding to that timestamp....
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript date object
JavaScript Date Object
September 1, 2008 - In the example below, we have passed milliseconds as an argument of the Date() constructor. If you pass the positive milliseconds as an argument, the object returns the date according to the 1st January 1970 00:00:00 + milliseconds. Otherwise, it returns the date according to the 1st January 1970 00:00:00 milliseconds if negative milliseconds passed as an argument. <html> <head> <title> JavaScript - Date object </title> </head> <body> <p id = "output"> </p> <script> const output = document.getElementById("output"); let date = new Date(999999999999); output.innerHTML += "The Date after 1st January, 1970 is - " + date + "<br>"; date = new Date(-999999999999); output.innerHTML += "The Date before 1st January, 1970 is - " + date; </script> </body> </html>
🌐
Reality Ripple
udn.realityripple.com › docs › Web › JavaScript › Reference › Global_Objects › Date › Date
Date() constructor - JavaScript
Creates a JavaScript Date instance that represents a single moment in time in a platform-independent format. Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.
🌐
Unibo
lia.disi.unibo.it › materiale › JS › developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date.html
Date - JavaScript | MDN
without the new operator) will return a string rather than a Date object; unlike other JavaScript object types, JavaScript Date objects have no literal syntax. Note: Where Date is called as a constructor with more than one argument, if values are greater than their logical range (e.g.
Find elsewhere
Top answer
1 of 2
7

Straight from the relevant portion of the ECMAScript 6 spec:

If Type(value) is Object and value has a [[DateValue]] internal slot, then Let tv be thisTimeValue(value).

Which basically says that if you pass the Date constructor a single argument and it's an object and it has the [[DateValue]] internal slot, then use that to initialize the new object.

So, what you are seeing is documented in the specification.

Here's more detail:

But, the ES5 spec is not the same and will do a conversion to a string when you do what you're doing which will then be parsed as a string by the constructor. While that will work to preserve everything down to the seconds, it will not preserve milliseconds since those are not present in the default string conversion. So, if you want a perfect copy, then you should do this in ES5 or earlier:

var date = new Date();
var date2 = new Date(date.getTime());
2 of 2
1

I would advise against that for now. This is what's going now under the browsers following different specs for the Date object.

ES 6.0:

var d1 = new Date();
var d2 = new Date(d1.getTime());
//ES6.0 basically gets the property that holds the timestamp straight from the object.

document.getElementById('results').innerHTML = 'Assert: ' + d1.valueOf() + ' === ' + d2.valueOf() + ' ' + (d1.valueOf() === d2.valueOf());
<pre id="results"></pre>

It does compare it perfectly BUT.... Here's how ES5.1 will handle that:

var d1 = new Date();
var d2 = new Date(Date.parse(d1.toString()));
//ES5.1 will attempt to parse the string representation of the Date object.

document.getElementById('results').innerHTML = 'Assert: ' + d1.valueOf() + ' === ' + d2.valueOf() + ' ' + (d1.valueOf() === d2.valueOf());
<pre id="results"></pre>

It basically gets rids of the milliseconds of the first Date object (Assertion might work if the first date object has no milliseconds, run the snippet a couple of times). Firefox seems to be following ES5.1 behaviour at the moment and Chrome ES6.0. Can't really say when they started adopting it.

I would definately not advise to pass the Date object as a constructor for a new Date object if the purpose is to clone the first Date object. Use Data.prototype.getTime() instead.

🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-constructor-property
JavaScript Date constructor Property - GeeksforGeeks
July 11, 2025 - The JavaScript date constructor, string constructor, and boolean constructor return function Date() { [native code] }., function String() { [native code] } and function Boolean() { [native code] } respectively.
🌐
CodingNomads
codingnomads.com › introduction-javascript-date-object
Beginners Guide to the Date Object in JavaScript
JavaScript's Date Object: A built-in global object for managing dates and times, offering methods for creation, manipulation, and formatting. Creating Date Instances: Use new Date() for current time or pass specific values to the constructor ...
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › data types
Date and time
Create a Date object with the time equal to number of milliseconds (1/1000 of a second) passed after the Jan 1st of 1970 UTC+0.
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript date constructor
JavaScript Date Constructor
September 1, 2008 - Javascript date constructor property returns a reference to the array function that created the instance's prototype. ... Returns the function that created this object's instance.
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - This returns the current date and ... as “yyyy-mm-dd”, you can use the Date object and extract the year, month, and day components, then concatenate them into a string with the desired format....
🌐
Scaler
scaler.com › topics › date-object-in-javascript
How to create a date object in JavaScript? - Scaler Topics
November 9, 2022 - Calling the Date constructor without any passing any parameter returns a new date object having values of current date and time- ... Above, we call the Date constructor without passing any parameter and assigned the return value in a variable currentDate. Then, we logged the currentDate on ...
🌐
MSR
rajamsr.com › home › javascript date constructor: how to master it in 10 minutes
JavaScript Date Constructor: How to Master It in 10 Minutes | MSR - Web Dev Simplified
December 3, 2023 - The constructor defines how the ... tasks. A built-in JavaScript object called JavaScript Date enables you to create, modify, and deal with dates and times....
🌐
Mozilla
interactive-examples.mdn.mozilla.net › pages › js › date-constructor.html
JavaScript Demo: Date Constructor
const date1 = new Date('December 17, 1995 03:24:00'); // Sun Dec 17 1995 03:24:00 GMT... const date2 = new Date('1995-12-17T03:24:00'); // Sun Dec 17 1995 03:24:00 GMT... console.log(date1 === date2); // Expected output: false console.log(date1 - date2); // Expected output: 0 · JavaScript ...