Javascript Date() method returns today's date and time and does not need any object to be called.
Its syntax is as follows −
Date()
Returns today's date and time.
Try the following example.
<html> <head> <title>JavaScript Date Method</title> </head> <body> <script type="text/javascript"> var dt = Date(); document.write("Date and Time : " + dt ); </script> </body> </html>
Date and Time : Sun Jul 15 2018 14:30:50 GMT-0500 (Central Daylight Time)