JavaScript Reference/Javascript Methods/getYear

Материал из Web эксперт
Версия от 11:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"getYear()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="var myDate = new Date(); alert(myDate.getYear());">get year</button> </body> </html>


     </source>
   
  


"getYear()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |Date | +----------------+--------------------------------------------------------------+

     </source>
   
  


"getYear()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Returns the year. When the year is before 2000, the return value is the year minus 1900. When the year is 2000 or after, the return value is the four-digit year.

Syntax:

dateName.getYear()


     </source>