<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Timezone support in Ruby</title>
	<atom:link href="http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/</link>
	<description></description>
	<pubDate>Tue, 06 Jan 2009 00:46:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Phil Ross</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-2566</link>
		<dc:creator>Phil Ross</dc:creator>
		<pubDate>Thu, 15 May 2008 22:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-2566</guid>
		<description>Madhu,

If you are using Rails 2.0 or earlier, you might want to take a look at the TzinfoTimezone plugin (http://agilewebdevelopment.com/plugins/tzinfo_timezone). This replaces the built in Rails TimeZone class with one that uses TZinfo. With this plugin installed, you'll still get Rails' standard list of timezones with the GMT offset when you use time_zone_options_for_select or time_zone_select. However, the TimeZone object has additional utc_to_local, local_to_utc and tzinfo methods to allow you to access the TZInfo functionality.

Edge Rails (2.1) now bundles a cut-down version of TZInfo and includes the functionality of TzinfoTimezone. See http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/ for more information.

Regards,

Phil</description>
		<content:encoded><![CDATA[<p>Madhu,</p>
<p>If you are using Rails 2.0 or earlier, you might want to take a look at the TzinfoTimezone plugin (http://agilewebdevelopment.com/plugins/tzinfo_timezone). This replaces the built in Rails TimeZone class with one that uses TZinfo. With this plugin installed, you&#8217;ll still get Rails&#8217; standard list of timezones with the GMT offset when you use time_zone_options_for_select or time_zone_select. However, the TimeZone object has additional utc_to_local, local_to_utc and tzinfo methods to allow you to access the TZInfo functionality.</p>
<p>Edge Rails (2.1) now bundles a cut-down version of TZInfo and includes the functionality of TzinfoTimezone. See <a href="http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/" rel="nofollow">http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/</a> for more information.</p>
<p>Regards,</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madhu Nallamani</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-2554</link>
		<dc:creator>Madhu Nallamani</dc:creator>
		<pubDate>Thu, 15 May 2008 16:47:19 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-2554</guid>
		<description>Hi Philip , 

Is there anyway I can display time in â€œUS-Centralâ€ or â€œUS-Easternâ€ format instead of â€œ America-New yorkâ€ or â€œ Europe-Athensâ€ format at the top of drop down list using Tzinfo . 

I am presently using â€œtime_zone_selectâ€ which displays US zones on top of drop down in â€œ America-New yorkâ€ format . 

 TZInfo::Timezone, :default =&#62; "America/Chicago" )%&#62;

I can display US zones in â€œ (GMT - 06:00 ) CentralTime (US &#38; Canada)â€ by using standard rails TimeZone (  ) . But , I will have problem when I use â€œutc_to_localâ€ method . 

Thanks,
Madhu Nallamani</description>
		<content:encoded><![CDATA[<p>Hi Philip , </p>
<p>Is there anyway I can display time in â€œUS-Centralâ€ or â€œUS-Easternâ€ format instead of â€œ America-New yorkâ€ or â€œ Europe-Athensâ€ format at the top of drop down list using Tzinfo . </p>
<p>I am presently using â€œtime_zone_selectâ€ which displays US zones on top of drop down in â€œ America-New yorkâ€ format . </p>
<p> TZInfo::Timezone, :default =&gt; &#8220;America/Chicago&#8221; )%&gt;</p>
<p>I can display US zones in â€œ (GMT - 06:00 ) CentralTime (US &amp; Canada)â€ by using standard rails TimeZone (  ) . But , I will have problem when I use â€œutc_to_localâ€ method . </p>
<p>Thanks,<br />
Madhu Nallamani</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Ross</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-270</link>
		<dc:creator>Phil Ross</dc:creator>
		<pubDate>Wed, 14 Jun 2006 19:37:44 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-270</guid>
		<description>TZInfo is the name of the module that contains all the timezone code.

Basic use of TZInfo involves code like:
&lt;pre&gt;tz = &lt;a href="http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html"&gt;TZInfo::Timezone&lt;/a&gt;.get("America/New_York")
local_time = tz.utc_to_local(my_time_in_utc)
utc_time = tz.local_to_utc(my_local_time)&lt;/pre&gt;
Scott's &lt;a href="http://lunchroom.lunchboxsoftware.com/pages/tzinfo_rails"&gt;how-to&lt;/a&gt; describes how you can add an attribute to an existing User model that returns the timezone. This is done using the Rails composed_of method. In the example, the field time_zone in the users table contains the timezone identifier for the user (e.g. America/New_York). composed_of exposes a &lt;a href="http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html"&gt;TZInfo::Timezone&lt;/a&gt; object as an attribute called tz.  You can then call utc_to_local, local_to_utc, etc on this timezone to convert the time.</description>
		<content:encoded><![CDATA[<p>TZInfo is the name of the module that contains all the timezone code.</p>
<p>Basic use of TZInfo involves code like:</p>
<pre>tz = <a href="http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html">TZInfo::Timezone</a>.get("America/New_York")
local_time = tz.utc_to_local(my_time_in_utc)
utc_time = tz.local_to_utc(my_local_time)</pre>
<p>Scott&#8217;s <a href="http://lunchroom.lunchboxsoftware.com/pages/tzinfo_rails">how-to</a> describes how you can add an attribute to an existing User model that returns the timezone. This is done using the Rails composed_of method. In the example, the field time_zone in the users table contains the timezone identifier for the user (e.g. America/New_York). composed_of exposes a <a href="http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html">TZInfo::Timezone</a> object as an attribute called tz.  You can then call utc_to_local, local_to_utc, etc on this timezone to convert the time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stirman</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-267</link>
		<dc:creator>stirman</dc:creator>
		<pubDate>Wed, 14 Jun 2006 17:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-267</guid>
		<description>I'm a little confused as to how to implement this, and the how-to by Scott seemed to skip over some of the initial set up.  After I require the gem, do I create a TZInfo model?

I desperately need to add this functionality to a little web app that is all done, minus timezone offset support!

Totally stoked that this TZ Library exists, thanks for your hard work!</description>
		<content:encoded><![CDATA[<p>I&#8217;m a little confused as to how to implement this, and the how-to by Scott seemed to skip over some of the initial set up.  After I require the gem, do I create a TZInfo model?</p>
<p>I desperately need to add this functionality to a little web app that is all done, minus timezone offset support!</p>
<p>Totally stoked that this TZ Library exists, thanks for your hard work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Ross</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-17</link>
		<dc:creator>Phil Ross</dc:creator>
		<pubDate>Mon, 05 Dec 2005 09:36:27 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-17</guid>
		<description>To use time_zone_select to display just US timezones, you will have to create a class with an all method that time_zone_options_for_select can use:

&lt;pre&gt;
class USTimezone
  def initialize(timezone)
    @timezone = timezone
  end
  
  def name
    @timezone.name
  end
  
  def to_s
    @timezone.to_s
  end
  
  def self.all
    TZInfo::Country.get('US').zones.sort.map {&#124;tz&#124; USTimezone.new(tz)}
  end
end
&lt;/pre&gt;


You can then use this class with:
&lt;pre&gt;
  &#60;%= time_zone_select 'user', 'timezone', nil, :model =&gt; USTimezone %&#62;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>To use time_zone_select to display just US timezones, you will have to create a class with an all method that time_zone_options_for_select can use:</p>
<pre>
class USTimezone
  def initialize(timezone)
    @timezone = timezone
  end

  def name
    @timezone.name
  end

  def to_s
    @timezone.to_s
  end

  def self.all
    TZInfo::Country.get('US').zones.sort.map {|tz| USTimezone.new(tz)}
  end
end
</pre>
<p>You can then use this class with:</p>
<pre>
  &lt;%= time_zone_select 'user', 'timezone', nil, :model => USTimezone %&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Rochford</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-16</link>
		<dc:creator>John Rochford</dc:creator>
		<pubDate>Mon, 05 Dec 2005 00:44:36 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-16</guid>
		<description>Phil - Great TimeZone library!

What would be your approach on displaying just the U.S. timezones when using time_zone_select ?

The code below returns all counties:

 TZInfo::Timezone %&#62;</description>
		<content:encoded><![CDATA[<p>Phil - Great TimeZone library!</p>
<p>What would be your approach on displaying just the U.S. timezones when using time_zone_select ?</p>
<p>The code below returns all counties:</p>
<p> TZInfo::Timezone %&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-15</link>
		<dc:creator>Ash</dc:creator>
		<pubDate>Thu, 01 Dec 2005 12:07:54 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-15</guid>
		<description>Hey dude, long time no communicat-i-o. I finally noticed the 'linking to' list in Wordpress :)


Um..... I got nothin, hope all is well in English Land, say hi to the other guys from me! :)


-
Australian Ash</description>
		<content:encoded><![CDATA[<p>Hey dude, long time no communicat-i-o. I finally noticed the &#8216;linking to&#8217; list in Wordpress <img src='http://blog.philross.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Um&#8230;.. I got nothin, hope all is well in English Land, say hi to the other guys from me! <img src='http://blog.philross.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>-<br />
Australian Ash</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe Creytens</title>
		<link>http://blog.philross.co.uk/2005/08/30/timezone-support-in-ruby/comment-page-1/#comment-14</link>
		<dc:creator>Philippe Creytens</dc:creator>
		<pubDate>Wed, 19 Oct 2005 22:44:30 +0000</pubDate>
		<guid isPermaLink="false">http://phil.ross.org.uk/?p=13#comment-14</guid>
		<description>Phil
Great job... we are developing a site where we heavily rely on UTC -&#62;user's timezone calculations. Too bad that we cannot get a dropdown in Rails with TZInfo that simulates the look-and-feel of the standard Rails TimeZone. I feel that Rails TimeZone dropdown is somehow more user-friendly by indicating the gmt +/- times for locations, rather than an alphabetical sort.</description>
		<content:encoded><![CDATA[<p>Phil<br />
Great job&#8230; we are developing a site where we heavily rely on UTC -&gt;user&#8217;s timezone calculations. Too bad that we cannot get a dropdown in Rails with TZInfo that simulates the look-and-feel of the standard Rails TimeZone. I feel that Rails TimeZone dropdown is somehow more user-friendly by indicating the gmt +/- times for locations, rather than an alphabetical sort.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
