[TZInfo-users] Time zone
philip at ross.org.uk
Wed Jun 21 09:37:34 EDT 2006
Jesper Andersen wrote:
> I seem to have some problem with this timezone. The problem is that any
> time, no matter what timezone is reported to be UTC time. The times are
> correct, just the timezone information returned with the time is wrong.
> Below are some examples. Am I doing something wrong or is this a bug?
You're not doing anything wrong - this is the intended behaviour at
present. I haven't yet been able to find a way to construct a Ruby Time
with a specific timezone. Time can either represent times in the local
timezone of the machine/environment or in UTC. As a result, TZInfo
always constructs Times in UTC and ignores the timezone of any instances
There's a tracker item for this issue:
If you want to get hold of the abbreviation for the time, you can use
the period_for_utc method:
c = Timezone.get 'Europe/Copenhagen'
=> Europe - Copenhagen
http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
More information about the TZInfo-users