From c40612041809fe289aba58aefa170bbe784aba1f Mon Sep 17 00:00:00 2001 From: t7yang Date: Mon, 10 Jan 2022 08:38:07 +0800 Subject: remove name attribute for zh-CN --- .../global_objects/date/getyear/index.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/date/getyear') diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/getyear/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/getyear/index.html index 1067341a6f..a35e5e4ac6 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/date/getyear/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/date/getyear/index.html @@ -7,15 +7,15 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getYear

getYear() 方法返回指定的本地日期的年份。因为 getYear 不返回千禧年[full years] ("year 2000 problem"),所以这个方法不再被使用,现在替换为 {{jsxref("Date.getFullYear", "getFullYear")}} .

-

Syntax

+

Syntax

dateObj.getYear() 
-

Parameters

+

Parameters

None.

-

Returns

+

Returns

The getYear method returns the year minus 1900; thus:

@@ -27,9 +27,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getYear

To take into account years before and after 2000, you should use {{jsxref("Date.getFullYear", "getFullYear()")}} instead of getYear so that the year is specified in full.

-

Backward Compatibility

+

Backward Compatibility

-

Behaviour in JavaScript 1.2 and earlier

+

Behaviour in JavaScript 1.2 and earlier

The getYear method returns either a 2-digit or 4-digit year:

@@ -38,9 +38,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getYear
  • For years less than 1900 or greater than 1999, the value returned by getYear is the four-digit year. For example, if the year is 1856, the value returned is 1856. If the year is 2026, the value returned is 2026.
  • -

    Examples

    +

    Examples

    -

    Example: Years between 1900 and 1999

    +

    Example: Years between 1900 and 1999

    The second statement assigns the value 95 to the variable year.

    @@ -48,7 +48,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/getYear var year = Xmas.getYear(); // returns 95 -

    Example: Years above 1999

    +

    Example: Years above 1999

    The second statement assigns the value 100 to the variable year.

    @@ -56,7 +56,7 @@ var year = Xmas.getYear(); // returns 95 var year = Xmas.getYear(); // returns 100 -

    Example: Years below 1900

    +

    Example: Years below 1900

    The second statement assigns the value -100 to the variable year.

    @@ -64,7 +64,7 @@ var year = Xmas.getYear(); // returns 100 var year = Xmas.getYear(); // returns -100 -

    Example: Setting and getting a year between 1900 and 1999

    +

    Example: Setting and getting a year between 1900 and 1999

    The second statement assigns the value 95 to the variable year, representing the year 1995.

    @@ -103,7 +103,7 @@ var year = Xmas.getYear(); // returns 95

    {{Compat("javascript.builtins.Date.getYear")}}

    -

    See also

    +

    See also