View Single Post
Old 12-09-2012, 08:54 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
It can be done with JavaScript but as not everyone has JavaScript you'll still need to check for it on the server.

To get the date so many years in the future less your one day you could use:

Code:
newDate = function(years) {
var dd, mm, dt;
dt = new Date();
dt.setFullYear(dt.getFullYear()+years);
dt.setDate(dt.getDate()-1);
dd = dt.getDate();
if (dd < 10) dd = '0'+dd;
mm = dt.getMonth()+1;
if (mm < 10) mm = '0'+mm;
return dd+'/'+mm+'/'+dt.getFullYear();
}
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote