The Date object is a datatype built into the JavaScript language. Date objects are created with new Date( ) as shown below −
new Date( ) new Date(milliseconds) new Date(datestring) new Date(year,month,date[,hour,minute,second,millisecond ])
Example
You can try to run the following code to implement Date object in JavaScript −
<html> <head> <title>JavaScript Dates</title> </head> <body> <script> var date = new Date(); document.write("dt.constructor is : " + date.constructor); </script> </body> </html>
Output
dt.constructor is : function Date() { [native code] }