Question in brief:
Is it possible to create a Time object with a time zone other than the
local time zone or GMT?
I’m relatively new to Ruby (coming from the Java world), and after
reading the docs and playing with Time a fair bit, I’ve decided that you
can’t create a Time object with an arbitrary time zone. Is this correct?
For example, let’s say my local time zone is PDT (GMT-8). Can I create a
Time object representing 16:00 EDT (GMT-5) in New York? Sure, I know I
can represent that time as 13:00 PDT or 21:00 GMT, but that’s not what I
want to do.
I’m writing an app that deals with user time zones across the globe. If
I normalize my users’ times to local or GMT, I lose information. I.e., I
would like my app to remember times exactly as it was input–if a time
was input as Eastern Time (US), it should be displayed as Eastern Time
upon retrieval. Can I store the time zone datum in the Time object, or
must I persist an addition time zone field along with the Time object?
The downside to keeping track of the time zone externally is that I
can’t take advantage of Time’s format method and it just seems kludgy in
I’d appreciate any feedback. Perhaps I’m going about this the wrong way.