How do I... Please

what is the code to display a date and time on my webpage?

Comments

  • ChroderChroder Senior Member The Royal RAM
    You can do it with a simple document.write, if you'd like. Take a look at the date object for more info (like getting full month names instead of a number etc).
    The date is:
    <script type="text/javascript">
    var date = new Date();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var year = date.getFullYear();
    var s = "/";
    
    document.writeln(month + "/" + day + "/" + year);
    </script>
    
  • kinkkink serious member VPS - Virtual Prince of the Server
    you will need a form named "sam" with an input box named "li"



    <script type="text/javascript">
    function twxfunction()
    {
    var re = new Date();
    setTimeout("twxfunction()",1000)
    var hys = re.getHours();
    var myn = re.getMinutes();
    var sec = re.getSeconds();
    if (sec < 10)(sec = "0" + sec);
    if (myn < 10)(myn = "0" + myn);
    if (hys < 10)(hys = "0" + hys);
    var h = document.sam.li.value;
    document.sam.li.value = hys + ":" + myn + ":" + sec ;
    }
    </script>
Sign In or Register to comment.