Results 1 to 6 of 6

Thread: Automatically updating month & year
      
   

  1. #1
    valwilson is offline Sergeant Major
    Join Date
    Jul 2008
    Posts
    86

    Default 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

  2. #2
    valwilson is offline Sergeant Major
    Join Date
    Jul 2008
    Posts
    86

    Question Re: Automatically updating month & year

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

  3. #3
    birminghampool is offline Private
    Join Date
    May 2008
    Location
    Birmingham
    Posts
    3

    Default Re: Automatically updating month & year

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


    This works

  4. #4
    birminghampool is offline Private
    Join Date
    May 2008
    Location
    Birmingham
    Posts
    3

    Default Re: Automatically updating month & year

    I meant the one at the beginning
    <B>

  5. #5
    wysiwyg4 is offline Major
    Join Date
    Nov 2007
    Posts
    481

    Arrow Re: Automatically updating month & 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>

  6. #6
    wysiwyg4 is offline Major
    Join Date
    Nov 2007
    Posts
    481

    Arrow Re: Automatically updating month & 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>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49