Do you know of the chances of this being "fixed" in any of the upcoming version(s) of Ruby?
sanj On Nov 13, 2007 5:21 PM, Philip Ross <[EMAIL PROTECTED]> wrote: > On 13/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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 > [email protected] > http://rubyforge.org/mailman/listinfo/tzinfo-users > -- Somewhere between a role model and a cautionary tale. _______________________________________________ TZInfo-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/tzinfo-users
