From: Tanaka Akira Date: 2006-07-21T00:03:45+09:00 Subject: Re: Time.parse has never visited Singapore? In article <87ac74z7ev.fsf@dessyku.is-a-geek.org>, Yohanes Santoso writes: > " > 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) > " > It specifies +nnnn format. > > In any case, Time.parse does not accept everything specified in > RFC822. It ignores UT and 1ALPHA (eg: 1Z for UTC and 1N for UTC+0100). 1ALPHA means an ALPHA. So, Z is a zone but 1Z is not. % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 UT 2007")' Thu Jul 19 19:47:57 UTC 2007 % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 Z 2007")' Thu Jul 19 19:47:57 UTC 2007 % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 N 2007")' Fri Jul 20 05:47:57 JST 2007 % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 A 2007")' Fri Jul 20 03:47:57 JST 2007 % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 B 2007")' Fri Jul 20 02:47:57 JST 2007 % ruby -rtime -e 'p Time.parse("Wed Jul 19 19:47:57 C 2007")' Fri Jul 20 01:47:57 JST 2007 My localtime is JST (+0900). Note that the comment of RFC822 has a bug: the signs of military zones are reversed. (See RFC1123 and RFC2822) time.rb interprets the ALPHA with fixed, RFC1123 and RFC2822, definition. -- Tanaka Akira