Wednesday, 15 May 2013

About Date() object


Till now you red abt Objects
  Now  we are going to use Date (); object
  now= new Date();
 You can ask what is this now and new date ();
 Hear I am assigning Date() Methods and properties to now variable.

Below example you can find new tags

 document.write("<b>Local time:</b> " + localtime + "<BR>");

Explanation:<b>for bold </b>

+ for concatenation

<BR> for next line


 localtime=now.toString();
 utctime=now.toGMTString();

Above toString() and toGMTString() are methods,As i explained freind-add(),freind-subtraction in previous example.

  Copy code from below(<html>tag) and paste it to notepad save it as thrid.htm run it.
  <html>
 <head>
 <title>Displaying Times and Dates </title>
 </head>
  <body>
 <h1>Current Date and time </h1>
  <p>
  <script type="text/javascript">
 now=new Date();
 localtime=now.toString();
 utctime=now.toGMTString();
  document.write("<b>Local time:</b> " + localtime + "<BR>");
 document.write("<b>UTC time:</b> " + localtime);
   </script>
 </p>
 </body>
  </html>

http://javascriptwithshrinivas.blogspot.com/2013/05/more-about-date-object.html

No comments:

Post a Comment