[TZInfo-users] Using TZ to convert to EST

Sanjay Vakil svakil at gmail.com
Tue Nov 13 17:28:49 EST 2007

Do you know of the chances of this being "fixed" in any of the
upcoming version(s) of Ruby?


On Nov 13, 2007 5:21 PM, Philip Ross <phil.ross at gmail.com> wrote:
> On 13/11/2007, johnsheahan at charter.net <johnsheahan at charter.net> wrote:
> > 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?
> I'm assuming that you are now seeing a time displayed that is correct
> for EST, but the formatted string is indicating that it is UTC.
> If you want to stop it saying UTC, then you will need to format the
> time yourself. There are several options to do this:
> 1) Use the Ruby on Rails to_formatted_s function on the Time object
> (http://wiki.rubyonrails.org/rails/pages/HowToDefineYourOwnDateFormat).
> 2) Use the strftime function of the returned Time object
> (http://www.ruby-doc.org/core/classes/Time.html#M000297). If you use
> %Z in the format string though, this will probably output UTC.
> 3) Use the TZInfo::Timezone.strftime function
> (http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html#M000058).
> This takes a time in UTC, converts it to local time and formats it
> using the same options as the Time strftime function. However, %Z will
> be translated to the correct abbreviation for the Timezone (i.e. EST
> or EDT for New York).
> 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

Somewhere between a role model and a cautionary tale.

More information about the TZInfo-users mailing list