Press "Enter" to skip to content

Date Example in JavaScript

Definition :

 It is an object of java script which is meant for providing you the methods for retrieving the system date.

Program :

<html>

     <head>

                     <script language=”javascript”>

                                    {

                                                  a=new Date();

                                                  document.write(a+”</br>”);

                                                  document.write(a.getMonth()+”</br>”);

                                                  document.write(a.getSeconds()+”</br>”);

                                                  document.write(a.getFullYear()+”</br>”);

                                                  document.write(a.getHours()+”</br>”);

                                                 }

                                </script>

                </head>

                <body>

                     <input type=”button” value=”get Data” onclick=”display()”/>

                </body>

</html>

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *