Automatically updating month & year

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • valwilson
    Sergeant Major

    • Jul 2008
    • 86

    Automatically updating month & year

    Hi,

    I am creating a website & I want to have text saying 'Updated for June 2009". Is it possible to have this date automatically refresh each month?

    I know the html to insert today's date (as given to me on this forum!)

    <B>
    <FONT style="FONT-SIZE:12pt" color="black" face="arial">
    <script language="JavaScript">
    <!--
    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);
    //-->
    </script>
    </FONT>
    </B>


    Can this be edited to just give a month & year, & if so is it possible to include the text 'Updated for' in this code? Or is there another way?

    Any help really appreciated.

    Val
  • valwilson
    Sergeant Major

    • Jul 2008
    • 86

    #2
    Re: Automatically updating month &amp; year

    Please...someone....anyone??

    Comment

    • birminghampool
      Private

      • May 2008
      • 3

      #3
      Re: Automatically updating month &amp; year

      Hi,
      After >B
      in your script press enter and opn the new line just type
      Updated


      This works

      Comment

      • birminghampool
        Private

        • May 2008
        • 3

        #4
        Re: Automatically updating month &amp; year

        I meant the one at the beginning
        <B>

        Comment

        • wysiwyg4
          Major

          • Nov 2007
          • 477

          #5
          Re: Automatically updating month &amp; year

          This will give you the current month and the year.

          <B>
          <FONT style="FONT-SIZE:12pt" color="black" face="arial">
          <script language="JavaScript">
          <!--
          var now = new Date();
          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 = months[now.getMonth()] + " " +
          (fourdigits(now.getYear()));
          document.write(today);
          //-->
          </script>
          </FONT>
          </B>
          Doable Personal Finance

          Comment

          • wysiwyg4
            Major

            • Nov 2007
            • 477

            #6
            Re: Automatically updating month &amp; year

            The following includes "Updated for".

            <B>
            <FONT style="FONT-SIZE:12pt" color="black" face="arial">
            <script language="JavaScript">
            <!--
            var now = new Date();
            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 = months[now.getMonth()] + " " +
            (fourdigits(now.getYear()));
            document.write('Updated for ',today);
            //-->
            </script>
            </FONT>
            </B>
            Doable Personal Finance

            Comment

            Working...
            X