Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   HTML (https://www.askmehelpdesk.com/forumdisplay.php?f=446)
-   -   HTML question (https://www.askmehelpdesk.com/showthread.php?t=2529)

  • Apr 8, 2003, 08:54 AM
    chrisbaker4937
    HTML question
    Hello,

    I would like my website to display the date automatically (without me having to update the page each day) , can anyone let me have HTML to do this ?

    I can understand that putting the time on the page could be more complicated allowing for time zones but hopefully the date is a bit easier.

    Thanks ?
  • Apr 8, 2003, 12:26 PM
    coreybryant
    HTML question
    Check out this site for some scripts & examples:
    http://www.scriptsearch.com/JavaScri...Date_and_Time/

    Corey
  • Apr 9, 2003, 07:31 AM
    chrisbaker4937
    HTML question
    Thanks for the info - I checked the site and a couple of the links are no longer valid and the other one had loads of html that I could not get to work...

    Any other help would be gratefully received. :-/
  • Apr 9, 2003, 08:07 AM
    coreybryant
    HTML question
    Afte looking at it again, this is what I came up with - only for the date. Place this somewhere before the </head>:
    <script language="JavaScript">
    <!--

    //Get Date
    Var months=new Array(13);
    Months[1]="January";
    Months[2]="February";
    Months[3]="March";
    Months[4]="April";
    Months[5]="May";
    Months[6]="June";
    Months[7]="July";
    Months[8]="August";
    Months[9]="September";
    Months[10]="October";
    Months[11]="November";
    Months[12]="December";
    Var time=new Date();
    Var lmonth=months[time.getMonth() + 1];
    Var date=time.getDate();
    Var year=time.getYear();
    If (year < 2000)
    Year = year + 1900;


    //-->
    </script>

    And then place this script wherever you want the date to appear:
    <script language="javascript">
    Document.write(lmonth + " " + date + ", " + year);
    </script>

    Corey
  • Apr 10, 2003, 03:44 AM
    chrisbaker4937
    HTML question
    ;)

    Thanks for your help - all OK now and used on my site.

    Regards

  • All times are GMT -7. The time now is 03:17 PM.