From b0b225dce1707ceda83a9b2779d4de971f2be78a Mon Sep 17 00:00:00 2001 From: Artyom Liou Date: Fri, 30 Apr 2021 14:06:25 +0800 Subject: web/http/headers/date (zh-TW translation) --- files/zh-tw/web/http/headers/date/index.html | 105 +++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 files/zh-tw/web/http/headers/date/index.html (limited to 'files/zh-tw') diff --git a/files/zh-tw/web/http/headers/date/index.html b/files/zh-tw/web/http/headers/date/index.html new file mode 100644 index 0000000000..74cebd36b2 --- /dev/null +++ b/files/zh-tw/web/http/headers/date/index.html @@ -0,0 +1,105 @@ +--- +title: Date +slug: Web/HTTP/Headers/Date +tags: +- General Header +- HTTP +- Reference +- header +--- +
{{HTTPSidebar}}
+ +

Date 標頭的值是傳送當下的日期與時間。

+ +
+

注意 Date 被列在 fetch spec 的 forbidden header names 清單中──也就是說這段程式不會送出 Date 標頭:

+ +
fetch('https://httpbin.org/get', {
+    'headers': {
+        'Date': (new Date()).toUTCString()
+    }
+})
+
+ + + + + + + + + + + + +
Header type{{Glossary("General header")}}
{{Glossary("Forbidden header name")}}yes
+ +

語法

+ +
Date: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
+
+ +

指令

+ +
+
<day-name>
+
代表星期幾,為 Mon、Tue、Wed、Thu、Fri、Sat 或 Sun 之一(區分大小寫)。
+
<day>
+
二位數日期,比如「04」或「23」。
+
<month>
+
月份,為 Jan、Feb、Mar、Apr、May、Jun、Jul、Aug、Sep、Oct、Nov、Dec 之一(區分大小寫)。
+
<year>
+
四位數年份,比如「1990」或「2016」。
+
<hour>
+
二位數小時,比如「09」或「23」。
+
<minute>
+
二位數分鐘,比如「04」或「59」。
+
<second>
+
二位數秒,比如「04」或「59」。
+
GMT
+
+

格林威治標準時間的意思。在 HTTP 中日期都是採用 GMT,絕不會顯示當地時間。

+
+
+ +

範例

+ +
Date: Wed, 21 Oct 2015 07:28:00 GMT
+
+ +
new Date().toUTCString()
+// "Mon, 09 Mar 2020 08:13:24 GMT"
+ +

規格

+ + + + + + + + + + + + + + +
SpecificationTitle
{{RFC("7231、Date、7.1.1.2")}}Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
+ +

瀏覽器相容性

+ + + +

{{Compat("http.headers.Date")}}

+ +

參閱

+ + -- cgit v1.2.3-54-g00ecf