RCR: Add Time#atZone

Analogous to Time#gmtime, but sets the time to zone z, where z is
specified as GMT +/- some number of hours (or possibly using the
standard “named” timezones). e.g.
t = Time.now.atZone(+3) or t = Time.now.atZone(“CST”)

martin

Hi,

···

In message “RCR: Add Time#atZone” on 02/09/28, Martin DeMello martindemello@yahoo.com writes:

Analogous to Time#gmtime, but sets the time to zone z, where z is
specified as GMT +/- some number of hours (or possibly using the
standard “named” timezones). e.g.
t = Time.now.atZone(+3) or t = Time.now.atZone(“CST”)

There’s no portable way to handle timezone except for GMT (UTC) and
localtime. For this RCR, we have to implement whole time handling
routines by ourselves. To tell the truth, I don’t want to.

						matz.

In article 42f186e.0209270825.663d5fe1@posting.google.com,
martindemello@yahoo.com (Martin DeMello) writes:

Analogous to Time#gmtime, but sets the time to zone z, where z is
specified as GMT +/- some number of hours (or possibly using the
standard “named” timezones). e.g.
t = Time.now.atZone(+3) or t = Time.now.atZone(“CST”)

If you have to parse RFC2822 Date: field, time.rb may help you.
It is distributed with ruby since 1.6.7.

Note that there are several standard definitions of a timezone
abbreviation. At least, CST is:

-06:00 in America/Chicago
-05:00 in America/Havana
+08:00 in Asia/Harbin
+09:30 in Australia/Darwin
+10:30 in Australia/Adelaide

···


Tanaka Akira