Hi Morten,
<%=time_zone_select("account", "time_zone",
TZInfo::Timezone.all.sort, :model => TZInfo::Timezone) %>
Actually the code you mentioned above will give a result in the format
you are looking for.
i.e ''Europe/Athens''
$tcode = @params[:account][:time_zone]
tz = TZInfo::Timezone.get($tcode)
tz = tz.local_to_utc(Time::now()).to_s
So, ''tz'' will provide you the converted time.
Hope it helps you and others.
Thanks,
Selva
Morten wrote:> Hi. Using this:
>
> <%= time_zone_select("account", "time_zone"
%>
>
> I get a list of time zones options, like eg.:
>
> <option value="Athens">(GMT+02:00)
Athens</option>
>
> But as I''m using TZInfo::Timezone, I need to map
''Athens'' to
> ''Europe/Athens''
>
> I can see that the mapping I''m looking for is present in the
> tzinfo_timezone plugin, but I cannot see how to access it.
>
> Anyone?
>
> Thanks.
>
> Morten
>
> PS: I''m aware that I could use
>
> <%=time_zone_select("account", "time_zone",
> TZInfo::Timezone.all.sort, :model => TZInfo::Timezone) %>
>
> But the resulting select values look horrible, so I''d like to
stick
> with the Rails presentation format.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---