• JavaScript Video Tutorials

JavaScript - Date() Method



Description

Javascript Date() method returns today's date and time and does not need any object to be called.

Syntax

Its syntax is as follows −

Date()

Return Value

Returns today's date and time.

Example

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>

Output

javascript_date_object.htm
Advertisements