Add a date to your page

Discussion in 'JavaScript' started by ishkey, Oct 18, 2008.

  1. ishkey Mod - Designer

    Add this javascript anywhere on the page you want todays date to show. If you just want to see how it looks, copy the entire code and save it as date.html, then open it with your browser.
    Code:
     
    <?xml version="1.0" encoding="windows-1252"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <!-- Created on: 10/15/2008 -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <title></title>
    </head>
    <body>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    var now = new Date();
    var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
    function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;
    }
    today = days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
    (fourdigits(now.getYear())) ;
    document.write(today);
    // End -->
    </script>
     
    </body>
    </html>
    
  2. pezboy45 Mod/Design & Coder [Pro]

    Awesome!
    I am actually going to use this....
    Right now.
    Thanks a bunch.
  3. genroxbro New Member

    hi

    the hscripts tool is based only on javascript and it would work on any web page.

    You can create any no of menus on that and the code is generated through that tool. U can just copy the code and paste it on the head section of the html page

    i.e
    <html><head> tool generated code </head>

    In your script they are using different technique , i couldnt follow up that code.

    Thanks & Regards
    _____________________________________
    Are you looking to get
    canadian payday loans ?