PDA

View Full Version : Automatically updating month & year



valwilson
06-24-2009, 05:05 PM
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
06-26-2009, 03:03 PM
Please...someone....anyone??

birminghampool
09-08-2009, 04:57 PM
Hi,
After >B
in your script press enter and opn the new line just type
Updated


This works

birminghampool
09-08-2009, 05:07 PM
I meant the one at the beginning
<B>

wysiwyg4
09-09-2009, 02:55 AM
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>

wysiwyg4
09-11-2009, 01:55 PM
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>