Definition and Usage
The getYear() method returns the year, as a two-digit OR a three/four-digit number.
The value returned by getYear() is not always four digits. For
years between 1900 and 1999 the getYear() method returns only two digits.
For other years (before 1900 and after 1999) the return is browsers
dependant:
Internet Explorer:
- Returns four digits for years before 1900 and after 1999.
Firefox:
- Returns a value less than 0 for years before 1900. For example, the year
1800 returns -100.
- Returns a value 100 or greater for years greater than or equal to 2000.
For example, the year 2008 returns 108.
Syntax
Tips and Notes
Note: This method is always used in conjunction with a Date object.
Important: The getYear() method should no longer be used. Use the getFullYear() method
instead!!
출처 : http://www.gotapi.com/html
설명을 간단히 하자면 getYear() 메소드 보다는 getFullYear() 메소드를 쓰는것이 좋다는 이야기다.
getYear() 메소드로는 브라우저에 따라.. 그리고 1900~1999 , 1900년 이전, 1999년 이후 에 따라서
리턴값이 많이 틀려지기 때문에 프로그램 만들경우 많은 고려가 필요하다.
받아와 애를 먹은 경우가 있었다.