var mydate = new Date(); var month = mydate.getMonth(); var day = mydate.getDate(); var year = mydate.getYear();
The first solution is to test if the year is less than 2000 and if so add 1900 to it like so:
if(year < 2000) year += 1900;
The second solution is to use the newer getFullDate() method which always returns a 4 digit year.
var year = mydate.getFullYear();