Adding the date and time to web site (just text)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Danny Canada
    Second Lieutenant

    • Apr 2007
    • 121

    Adding the date and time to web site (just text)

    Does anyone have a simple code to add the date and time to my home page as just text (not a button and approximately a size 8 arial font)?

    Thanks!!!!

    *Everyone one in here offering assistance have been absolutely fabulous.
  • bill2006
    Lieutenant General

    • May 2006
    • 3421

    #2
    Re: Adding the date and time to web site (just text)

    Try this, you can change the font and size:

    <FONT style="font-size:13px" color="#000000" face="Comic Sans MS">
    <script language="JavaScript" type="text/javascript">
    <!--
    var
    month = new Array();
    month[0]="January";
    month[1]="February";
    month[2]="March";
    month[3]="April";
    month[4]="May";
    month[5]="June";
    month[6]="July";
    month[7]="August";
    month[8]="September";
    month[9]="October";
    month[10]="November";
    month[11]="December";
    var
    day = new Array();
    day[0]="Sunday";
    day[1]="Monday";
    day[2]="Tuesday";
    day[3]="Wednesday";
    day[4]="Thursday";
    day[5]="Friday";
    day[6]="Saturday";
    today = new Date();
    date = today.getDate();
    day = (day[today.getDay()]);
    month = (month[today.getMonth()]);
    year = (today.getFullYear());
    suffix = (date==1 || date==21 || date==31) ? "st" : "th" &&
    (date==2 || date==22) ? "nd" : "th" && (date==3 || date==23) ? "rd" : "th"
    function print_date()
    {
    document.write(month + "&nbsp;" + date + "," + "&nbsp;" + year);
    }
    // -->
    </script>
    <script>
    <!--
    print_date();
    //-->
    </script>
    Bill
    www.blueearthtea.com
    www.ftaaconsulting.com
    www.iaval.com
    www.theemeraldbay.com

    Comment

    • davidundalicia
      General

      • Mar 2006
      • 6294

      #3
      Re: Adding the date and time to web site (just text)

      Heres a simple script that you just add to an html box and then move the box to where ever you want on the page:

      <SCRIPT>
      var mydate=new Date()
      var theYear=mydate.getFullYear()
      var day=mydate.getDay()
      var month=mydate.getMonth()
      var daym=mydate.getDate()
      if (daym<10)
      daym="0"+daym
      var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
      var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")
      document.write(dayarray[day]+", "+montharray[month]+" "+daym+", "+theYear)
      </SCRIPT>
      Have fun
      Regards..... David

      Step by Step Visual Tutorials for the complete beginner
      Newbies / Beginners Forum
      FREE Membership Login Scripts: - Meta Tags Analyzer
      My Social Networking Site - Free Contact Forms
      Finished your New website!! Now get it noticed Here:

      Comment

      • bill2006
        Lieutenant General

        • May 2006
        • 3421

        #4
        Re: Adding the date and time to web site (just text)

        Just noticed that RaceFan and NavalDesigns had already provided codes.


        Please post your URL, www.
        Bill
        www.blueearthtea.com
        www.ftaaconsulting.com
        www.iaval.com
        www.theemeraldbay.com

        Comment

        • Danny Canada
          Second Lieutenant

          • Apr 2007
          • 121

          #5
          Re: Adding the date and time to web site (just text)

          Thanks Bill2006!!

          The code works great!! However, it doesn't display the day of the week. I would like to have show as: Wednesday, April 4 2007

          Am I doing something wrong?

          Danny

          Comment

          • Collectors-info
            General

            • Feb 2006
            • 8703

            #6
            Re: Adding the date and time to web site (just text)

            Hi, change this part at the bottom of the script to give the day & order you wanted.

            {
            document.write(day + "&nbsp;" + date + "&nbsp;" + month + "&nbsp;" + year);
            }
            Regards Chris.

            Collectables, Collecting, collectors-info.com

            www.chrismorris.co.uk

            House build project

            Comment

            • Danny Canada
              Second Lieutenant

              • Apr 2007
              • 121

              #7
              Re: Adding the date and time to web site (just text)

              Thanks Collectors-info!!

              Worked like a charm... Just had to play around with positioning as well as change the text color to 'white"

              Danny

              Comment

              • bill2006
                Lieutenant General

                • May 2006
                • 3421

                #8
                Re: Adding the date and time to web site (just text)

                Thank you Chris,
                I don't show the day of the week and had deleted that part.
                Bill
                www.blueearthtea.com
                www.ftaaconsulting.com
                www.iaval.com
                www.theemeraldbay.com

                Comment

                • Danny Canada
                  Second Lieutenant

                  • Apr 2007
                  • 121

                  #9
                  Re: Adding the date and time to web site (just text)

                  Thanks for all your help and assistance on this post as well Bill!!

                  You guys (and gals) are great!!

                  Comment

                  • Tomissan
                    Second Lieutenant

                    • Jan 2006
                    • 107

                    #10
                    Re: Adding the date and time to web site (just text)

                    don't know if you still need it, if you do, just copy and paste this into your html...
                    <iframe src="http://free.timeanddate.com/clock/iedgxdc/n28/fs15/bo2/tt0/ts1" frameborder="0" width="303" height="21"></iframe>

                    or, go to www.timeanddate.com and chose the format you want.

                    tomissan
                    ___________________________

                    thai-land-house.com is your first and best source for all of the information you&#8217;re looking for. From general topics to more of what you would expect to find here, thai-land-house.com has it all. We hope you find what you are searching for!
                    Thai House Plans
                    Interior - Exterior, 3D Design

                    www.Thai-Land-House.com

                    Comment

                    Working...
                    X