Is it possible to put date on HTML page

Discussion in 'JavaScript' started by banibratamitra, Jan 8, 2010.

  1. #1
    Hi, can it possible to put the current date and time on the Html page .Kindly give an example :(
     
    banibratamitra, Jan 8, 2010 IP
  2. Avalon Systems

    Avalon Systems Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <script language="javascript" type="text/javascript">
    document.write("<strong>"+Date()+".</strong>")
    </script>
     
    Avalon Systems, Jan 8, 2010 IP
  3. yoavmatchulsky

    yoavmatchulsky Member

    Messages:
    57
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #3
    document.write is not a best technique.

    how about this:
    
    <body onload="document.getElementById('date').innerHTML = new Date();">
    
    <span id="date"></span>
    
    Code (markup):
     
    yoavmatchulsky, Jan 9, 2010 IP