* RFC 822 第5章 ** 5. DATE AND TIME SPECIFICATION *** 5.1. SYNTAX [PRE[ date-time = [ day "," ] date time ; dd mm yy ; hh:mm:ss zzz ]PRE] [PRE[ day = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun" ]PRE] [PRE[ date = 1*2DIGIT month 2DIGIT ; day month year ; e.g. 20 Jun 82 ]PRE] [PRE[ month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" ]PRE] [PRE[ time = hour zone ; ANSI and Military ]PRE] [PRE[ hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] ; 00:00:00 - 23:59:59 ]PRE] [PRE[ zone = "UT" / "GMT" ; Universal Time ; North American : UT / "EST" / "EDT" ; Eastern: - 5/ - 4 / "CST" / "CDT" ; Central: - 6/ - 5 / "MST" / "MDT" ; Mountain: - 7/ - 6 / "PST" / "PDT" ; Pacific: - 8/ - 7 / 1ALPHA ; Military: Z = UT; ; A:-1; (J not used) ; M:-12; N:+1; Y:+12 / ( ("+" / "-") 4DIGIT ) ; Local differential ; hours+min. (HHMM) ]PRE] *** 5.2. SEMANTICS [PRE[ If included, day-of-week must be the day implied by the date specification. ]PRE] [PRE[ Time zone may be indicated in several ways. "UT" is Univer- sal Time (formerly called "Greenwich Mean Time"); "GMT" is per- mitted as a reference to Universal Time. The military standard uses a single character for each zone. "Z" is Universal Time. "A" indicates one hour earlier, and "M" indicates 12 hours ear- lier; "N" is one hour later, and "Y" is 12 hours later. The letter "J" is not used. The other remaining two forms are taken from ANSI standard X3.51-1975. One allows explicit indication of the amount of offset from UT; the other uses common 3-character strings for indicating time zones in North America. ]PRE] * RFC 1123 第5.2.14節 ** 5.2.14 RFC-822 Date and Time Specification: RFC-822 Section 5 [PRE[ The syntax for the date is hereby changed to: ]PRE] [PRE[ date = 1*2DIGIT month 2*4DIGIT ]PRE] [PRE[ All mail software SHOULD use 4-digit years in dates, to ease the transition to the next century. ]PRE] [PRE[ There is a strong trend towards the use of numeric timezone indicators, and implementations SHOULD use numeric timezones instead of timezone names. However, all implementations MUST accept either notation. If timezone names are used, they MUST be exactly as defined in RFC-822. ]PRE] [PRE[ The military time zones are specified incorrectly in RFC-822: they count the wrong way from UT (the signs are reversed). As a result, military time zones in RFC-822 headers carry no information. ]PRE] [PRE[ Finally, note that there is a typo in the definition of "zone" in the syntax summary of appendix D; the correct definition occurs in Section 3 of RFC-822. ]PRE] * 説明 「曜日(英略), 日 月(英略) 年 時:分:秒 時間帯」という形式です。 このうち、曜日と秒は省略可能です。 年は2桁の西暦年でしたが、 RFC 1123 で4桁に修正されました。 (ちなみに、なぜか RFC 822 の前の世代の[[RFC733の日付形式]]では 4桁も OK になっていました。) 時間帯は数字で書く方法と文字列で書く方法がありますが、 RFC 1123 (や後の[[RFC2822の日付形式]]) では数字で書く方法を推奨しています。 [[時間帯を表す文字列]]は前の世代の[[RFC733の日付形式]]から種類が減っています。 一方実際にはここで示されていないもの (例 JST = +0900) がしばしば 使われました。 時間帯を表す文字列には、軍の記法もありますが、 RFC 733, 822 の BNF の注釈では符号が逆になっています。このため実装により解釈が 正反対になってしまい、 RFC 1123 は「この書き方は情報を伝達しない」、 RFC 2822 は「不明な時間帯と解釈すべし」としています。 * 実装上の注意点 RFC 822 の BNF には直接現れていませんが、 [[RFC822のlinear-white-space]] の挿入があり得ます。すなわち、 [PRE[ Wed (= Wednesday), 15 (th) Mar (March = 3rd month of year) 2002 12 (hour):32 (minute):23 (second) (timezone =) +0900 (JST) ]PRE] という書き方も仕様上は問題ありません。 時間帯を表す文字列についての注釈に間違いがあります(前述)。 また、仕様に定められていない[[時間帯を表す文字列]]が使われていることが 少なからずあります。 (最近は少なくなりました。) RFC 822 の最後の BNF syntax は timezone が途中で途切れています。 (RFC 1123 に言及あり。) RFC 822 の message 例中に登場する日付 「27 Aug 76 0932 PDT」 は時・分の間に「:」が入らない RFC 733 以前の書き方で、 不適当です。 新しい実装は、 RFC 822 の日付形式の subset である [[RFC2822の日付形式]] に沿うことが望ましいと考えられます。 * SEE ALSO - [[日付形式]] - [[RFC733の日付形式]] - [[RFC2822の日付形式]] * RFC の部分の LICENSE See [[RFCのライセンス]] * 例 -[7] [CODE(example)[Thu, 04 Oct 2007 23:59:45 +0000]] [SRC@en[[[RSS Best Practices Profile]]]] -[8] [CODE(example)[Thu, 04 Oct 2007 23:59:45 -0000]] [SRC@en[[[RSS Best Practices Profile]]]] -[9] [CODE(example)[Thu, 04 Oct 2007 23:59:45 GMT]] [SRC@en[[[RSS Best Practices Profile]]]] * メモ - [1] 1993年の調査では半分くらいのメッセージが4桁年号に移行していたとか。 (RFC 1123 は1989年。) 時間帯は数値指定も多いものの文字列指定のほうが圧倒的ですかね。非標準名もよく見かけます。 - [2] [WEAK[2003-01-25 14:07]] ''>>1'': 今でも文字列名の時間帯はたまに見かけますね。2桁年号とか、秒指定がないのとかはもう何年も見ていませんが。 [3] [[OPML]] は [[RFC 822の日付形式]]を採用しているとしています。 しかし、実例では[[4桁年号]]が用いられています。 実装が[[2桁年号]]や [CODE(ABNF)@en[[[comment]]]] に対応しているのかは謎です。 ([[名無しさん]]) [4] [[RSS 2.0]] は (仕様書内で一貫していない部分もありますが) [[RFC 822]] の[[日付形式]]を採用し、[[年号]]は4桁でもよく、4桁が望ましいとしています。 ;; [CITE[RSS 2.0 Specification]] ([CODE[2007-01-03 19:03:10 +09:00]] 版) ([[名無しさん]]) [5] [CITE@en[RSS Best Practices Profile]] ([CODE[2008-10-23 18:58:35 +09:00]] 版) [[RSS 2.0]] [[文書]]に関して、 Best Practices Profile として次のようなことを述べています: - [[4桁年号]]を使用[['''するべきです''']]。 - [[空白]]を使えるところに[[注釈]]を使ったり、複数個の[[間隔]]を挿入したり[['''するべきではありません''']]。 - [CODE(822)[[[Z]]]] 以外の1文字[[時間帯]]文字列は使用[['''するべきではありません''']]。 - [[UTC]] を使うのが最も[[相互運用性]]上優れているようです。 - [[月]]の名前は先頭を[[大文字]]、後は[[小文字]]に、[[時間帯]]の名前はすべて[[大文字]]に[['''するべきです''']]。 - [[日]]の[[先導零]]は省略[['''して構いません''']]。 - [[アメリカ合衆国]]の[[時間帯]]を表す文字列や丁度の[[時間]] (hour) の差を表す[[時間帯]]は[[相互運用性]]が高いようです。 ([[名無しさん]]) [6] 現実の [[RSS]] [[文書]]の日付は [[RFC 822]] に適合していないことがあります。 例えば、[[時]]が1桁だったりします。 [10] [CITE@ja[M.C.P.C.: 「RSS 簡単一発作成 『RSS 生成 CGI』」から書き出されるRSS 2.0の日付情報が不正なので直すパッチ]] ([TIME[2009-03-15 11:02:14 +09:00]] 版) >> -○正 > "Fri, 01 Jun 2005 03:00:00 +0900" (一例です 文字の間のスペースに注意してください) -○誤 > "Fri, 01 Mar 2009 03:00:00 +09:00" >とか出まして、RFC 822に従っていないので、XML::Feed(が使っているDateTime)が日付として認識できなかったようです。 > RSS生成スクリプトでした。 > RSS簡単一発作成『RSS 生成 CGI』 - futomi's CGI Cafe [www.futomi.com] [11] [CITE[OASIS CAM V1.1 Specification]] ( ([TIME[2007-06-18 21:16:59 +09:00]] 版))