[TZInfo-users] Using TZ to convert to EST

johnsheahan at charter.net johnsheahan at charter.net
Tue Nov 13 12:02:38 EST 2007

Thanks Philip,

I am getting the local time but can't seem to get the time to be displayed in EST.

I'm sorry I don't understand.....How should I change my code to convert to EST?

Thanks again for the help.

----- Original Message ----- 
From: "Philip Ross" <phil.ross at gmail.com>
To: "General discussion for TZInfo users" <tzinfo-users at rubyforge.org>
Sent: Tuesday, November 13, 2007 9:22 AM
Subject: Re: [TZInfo-users] Using TZ to convert to EST

> On 13/11/2007, John Sheahan <johnsheahan at charter.net> wrote:
>> Thanks alot for pointing me in the right direction, Philip.
>> Your explaination caused me to look hard at my Timezone.get statement and
>> found that I was missing the _ between New and York.
>> Once I fixed this, I am now getting time on my view, however, it is still in
>> UTC.
>> Here's my code that is giving me UTC:
>> tz = TZInfo::Timezone.get('America/New_York')
>> @local = tz.utc_to_local(tz.now)
>> My service provider that my server is in is giving me Mountain Time, now
>> that I have been able to change this to UTC, How can I change this to
>> convert the UTC time to EST?
> tz.now will give you the current local time in the timezone -
> internally it runs tz.utc_to_local(Time.now.utc). You don't need the
> extra call to utc_to_local.
> Note that the local time returned will be described as UTC because
> Ruby doesn't support arbitrary local timezones. The value of the time
> will be the correct local time though.
> Regards,
> Phil
> -- 
> Phil Ross
> http://tzinfo.rubyforge.org/ -- DST-aware timezone library for Ruby
> _______________________________________________
> TZInfo-users mailing list
> TZInfo-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/tzinfo-users

More information about the TZInfo-users mailing list