Forum Moderators: open

Message Too Old, No Replies

How to display next year's date?

         

facewax

8:00 am on Oct 7, 2005 (gmt 0)

10+ Year Member



I have an application form for an academic institution where I need to display on a page the year of entry, so for anyone applying in 2005 it would show 2006, and so on. Is there a way of doing this in javascript?

Scally_Ally

8:15 am on Oct 7, 2005 (gmt 0)

10+ Year Member



function nextDate(thisDate){
var d;
var m;
var y;
var nextDate;
var temp = new Array();
temp = thisDate.split('/');
d = temp[0].toString();
m = temp[1].toString();
temp[2] = temp[2] * 1 ;//make number
y = temp[2] + 1;
nextDate = d + '/' + m + '/' + y;
}

something like that i think.

Havent tried it so you may have to tweak it a little

Bernard Marx

12:21 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



var nextYear = new Date().getFullYear() +1;

;)

Scally_Ally

1:01 pm on Oct 7, 2005 (gmt 0)

10+ Year Member



lol,

or you could just do that

Bernard Marx

1:06 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Having access to a little resourcefulness like yours ain't such a bad thing either, Scally.