From 43a5cac2eff22c21071800e13bef12af9d3a37d0 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 13:12:08 +0100 Subject: unslug zh-tw: move --- .../global_objects/date/prototype/index.html | 246 --------------------- 1 file changed, 246 deletions(-) delete mode 100644 files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html (limited to 'files/zh-tw/web/javascript/reference/global_objects/date') diff --git a/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html b/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html deleted file mode 100644 index 5490743ec0..0000000000 --- a/files/zh-tw/web/javascript/reference/global_objects/date/prototype/index.html +++ /dev/null @@ -1,246 +0,0 @@ ---- -title: Date.prototype -slug: Web/JavaScript/Reference/Global_Objects/Date/prototype -tags: - - Date - - JavaScript - - 原型 - - 參考資料 - - 屬性 -translation_of: Web/JavaScript/Reference/Global_Objects/Date -translation_of_original: Web/JavaScript/Reference/Global_Objects/Date/prototype ---- -
{{JSRef}}
- -

Date.prototype 屬性表示 {{jsxref("Date")}} 建構子的原型。

- -
{{js_property_attributes(0, 0, 1)}}
- -

描述

- -

JavaScript {{jsxref("Date")}} 實體繼承自 Date.prototype。你可以藉由改變建構子的原型物件,來影響所有繼承自 JavaScript {{jsxref("Date")}} 的實體。

- -

為了千年年份(換個說法,考慮現在已到了 2000 年)的相容性,設定上你應該採用完整的年份。舉例來說,使用 1998 而不是 98 。為了讓你能取得完整的年份資料, Javascript 包含了 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} , {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} , {{jsxref("Date.prototype.getUTCFullYear()", "getUTCFullYear()")}} 以及 {{jsxref("Date.prototype.setUTCFullYear()", "setUTCFullYear()")}} 方法。

- -

自 ECMAScript 6 開始, Date.prototype 物件只是個一般物件,而不是一個 {{jsxref("Date")}} 實體。

- -

屬性

- -
-
Date.prototype.constructor
-
回傳一個能建立實體的函數,這是 {{jsxref("Date")}} 預設的建構子。
-
- -

方法

- -

Getter

- -
-
{{jsxref("Date.prototype.getDate()")}}
-
回傳本地時間月份中的日期(1-31)。
-
{{jsxref("Date.prototype.getDay()")}}
-
回傳本地時間星期中的日子(0-6)。
-
{{jsxref("Date.prototype.getFullYear()")}}
-
回傳本地時間的年份( 以 4 位數表現)。
-
{{jsxref("Date.prototype.getHours()")}}
-
回傳本地時間的小時(0-23)。
-
{{jsxref("Date.prototype.getMilliseconds()")}}
-
回傳本地時間的毫秒數(0-999)。
-
{{jsxref("Date.prototype.getMinutes()")}}
-
回傳本地時間的分鐘數(0-59)。
-
{{jsxref("Date.prototype.getMonth()")}}
-
回傳本地時間的月份(0-11)。
-
{{jsxref("Date.prototype.getSeconds()")}}
-
回傳本地時間的秒數(0-59)。
-
{{jsxref("Date.prototype.getTime()")}}
-
回傳由 1970-01-01 00:00:00 UTC 開始,到代表時間經過的毫秒數(以負值表示 1970 年之前的時間)。
-
{{jsxref("Date.prototype.getTimezoneOffset()")}}
-
回傳本地時差為多少分鐘。
-
{{jsxref("Date.prototype.getUTCDate()")}}
-
回傳標準時間的在月份中的日期(1-31)。
-
{{jsxref("Date.prototype.getUTCDay()")}}
-
回傳標準時間在星期中的日子(0-6)。
-
{{jsxref("Date.prototype.getUTCFullYear()")}}
-
回傳標準時間的年份( 以 4 位數表現)。
-
{{jsxref("Date.prototype.getUTCHours()")}}
-
回傳標準時間的小時數(0-23)。
-
{{jsxref("Date.prototype.getUTCMilliseconds()")}}
-
回傳標準時間裡的毫秒數(0-999)。
-
{{jsxref("Date.prototype.getUTCMinutes()")}}
-
回傳標準時間的分鐘數(0-59)。
-
{{jsxref("Date.prototype.getUTCMonth()")}}
-
回傳標準時間的月份數(0-11)。
-
{{jsxref("Date.prototype.getUTCSeconds()")}}
-
回傳標準時間的秒數(0-59)。
-
{{jsxref("Date.prototype.getYear()")}} {{deprecated_inline}}
-
回本地時間的年份(通常 2-3 位數)。用 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}} 取代。
-
- -

Setter

- -
-
{{jsxref("Date.prototype.setDate()")}}
-
設定本地時間月份中的日期。
-
{{jsxref("Date.prototype.setFullYear()")}}
-
設定本地時間的完整年份(以 4 位數表達 4 位數年份)。
-
{{jsxref("Date.prototype.setHours()")}}
-
設定本地時間的小時數。
-
{{jsxref("Date.prototype.setMilliseconds()")}}
-
設定本地時間的毫秒數。
-
{{jsxref("Date.prototype.setMinutes()")}}
-
設定本地時間的分鐘數。
-
{{jsxref("Date.prototype.setMonth()")}}
-
設定本地時間的月份。
-
{{jsxref("Date.prototype.setSeconds()")}}
-
設定本地時間的秒數。
-
{{jsxref("Date.prototype.setTime()")}}
-
設定這個 {{jsxref("Date")}} 物件距 1970-01-01 00:00:00 UTC 的毫秒數,允許使用負值表示之前的時間。
-
{{jsxref("Date.prototype.setUTCDate()")}}
-
設定標準時間月份中的日期。
-
{{jsxref("Date.prototype.setUTCFullYear()")}}
-
設定標準時間的完整年份(以 4 位數表示 4 位數年分)。
-
{{jsxref("Date.prototype.setUTCHours()")}}
-
設定標準時間的小時數。
-
{{jsxref("Date.prototype.setUTCMilliseconds()")}}
-
設定標準時間的毫秒數。
-
{{jsxref("Date.prototype.setUTCMinutes()")}}
-
設定標準時間的分鐘數。
-
{{jsxref("Date.prototype.setUTCMonth()")}}
-
設定標準時間的月份數。
-
{{jsxref("Date.prototype.setUTCSeconds()")}}
-
設定標準時間的秒數。
-
{{jsxref("Date.prototype.setYear()")}} {{deprecated_inline}}
-
設定本地時間的年份(使用 2-3 位數)。使用 {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} 取代。
-
- -

Conversion getter

- -
-
{{jsxref("Date.prototype.toDateString()")}}
-
以可閱讀的字串型式,回傳 {{jsxref("Date")}} 的部分資訊。
-
{{jsxref("Date.prototype.toISOString()")}}
-
將日期時間轉換成 ISO 8601 格式的字串回傳。
-
{{jsxref("Date.prototype.toJSON()")}}
-
回傳等義於 {{jsxref("Date")}} 物件使用 {{jsxref("Date.prototype.toISOString()", "toISOString()")}} 方法的結果。特別使用 {{jsxref("JSON.stringify()")}} 處理。
-
{{jsxref("Date.prototype.toGMTString()")}} {{deprecated_inline}}
-
回傳 {{jsxref("Date")}} 以 GMT (UT) 時區基準代表的時間字串。使用 {{jsxref("Date.prototype.toUTCString()", "toUTCString()")}} 方法來取代。
-
{{jsxref("Date.prototype.toLocaleDateString()")}}
-
依照系統的時間地區設定,回傳日期字串。
-
{{jsxref("Date.prototype.toLocaleFormat()")}} {{non-standard_inline}}
-
傳入格式化字串參數,將日期時間轉換成指定格式的字串。
-
{{jsxref("Date.prototype.toLocaleString()")}}
-
回傳依系統的地區設定導出的日期時間字串。覆寫自 {{jsxref("Object.prototype.toLocaleString()")}} 方法。
-
{{jsxref("Date.prototype.toLocaleTimeString()")}}
-
回傳依系統的地區設定導出的時間字串。
-
{{jsxref("Date.prototype.toSource()")}} {{non-standard_inline}}
-
回傳一個建立相同 {{jsxref("Date")}} 物件的程式碼字串;你可以拿這個結果來建立新物件。覆寫自 {{jsxref("Object.prototype.toSource()")}} 方法。
-
{{jsxref("Date.prototype.toString()")}}
-
回傳代表此 {{jsxref("Date")}} 物件的字串。覆寫自 {{jsxref("Object.prototype.toString()")}} 方法。
-
{{jsxref("Date.prototype.toTimeString()")}}
-
以人類可讀的格式,回傳時間部分的字串。
-
{{jsxref("Date.prototype.toUTCString()")}}
-
依 UTC 時區,轉換出時間日期字串。
-
{{jsxref("Date.prototype.valueOf()")}}
-
回傳 {{jsxref("Date")}} 物件的原始數值。覆寫自 {{jsxref("Object.prototype.valueOf()")}} 方法。
-
- -

規範

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
規範狀態
{{SpecName('ES1')}}{{Spec2('ES1')}}初步定義。實作在 JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.9.5', 'Date.prototype')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}{{Spec2('ESDraft')}} 
- -

瀏覽器相容性

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
平台ChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本支援{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
一般物件{{CompatUnknown}}{{CompatGeckoDesktop("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
平台AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本支援{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
一般物件{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("41")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
-
-- cgit v1.2.3-54-g00ecf