Hello everyone, I am using rails 3.2.8. I want to change time zone to New York time. I changed following, but didn''t work #config/application.rb config.time_zone = ''Eastern Time (US & Canada)'' config.active_record.default_timezone = ''Eastern Time (US & Canada)'' If am wrong please clarify. Thank You! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/m4Yr5fIi9CYJ. For more options, visit https://groups.google.com/groups/opt_out.
Read. http://guides.rubyonrails.org/i18n.html -- Dheeraj Kumar On Thursday 7 February 2013 at 11:15 AM, Saravanan P wrote:> Hello everyone, > > I am using rails 3.2.8. > I want to change time zone to New York time. > I changed following, but didn''t work > > #config/application.rb > config.time_zone = ''Eastern Time (US & Canada)'' > config.active_record.default_timezone = ''Eastern Time (US & Canada)'' > > > > If am wrong please clarify. > > Thank You! > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/m4Yr5fIi9CYJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
1.9.3-p286 :001 > Time.zone.now => Thu, 07 Feb 2013 06:34:49 UTC +00:00 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' => "Eastern Time (US & Canada)" 1.9.3-p286 :003 > Time.zone.now => Thu, 07 Feb 2013 01:35:00 EST -05:00 On Thu, Feb 7, 2013 at 11:24 AM, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Read. http://guides.rubyonrails.org/i18n.html > > -- > Dheeraj Kumar > > On Thursday 7 February 2013 at 11:15 AM, Saravanan P wrote: > > Hello everyone, > > I am using rails 3.2.8. > I want to change time zone to New York time. > I changed following, but didn''t work > > #config/application.rb > config.time_zone = ''Eastern Time (US & Canada)'' > config.active_record.default_timezone = ''Eastern Time (US & Canada)'' > > > If am wrong please clarify. > > Thank You! > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/m4Yr5fIi9CYJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 7 February 2013 05:54, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Read. http://guides.rubyonrails.org/i18n.htmlIf that does not help then tell us what you mean by it not working. Colin> > -- > Dheeraj Kumar > > On Thursday 7 February 2013 at 11:15 AM, Saravanan P wrote: > > Hello everyone, > > I am using rails 3.2.8. > I want to change time zone to New York time. > I changed following, but didn''t work > > #config/application.rb > config.time_zone = ''Eastern Time (US & Canada)'' > config.active_record.default_timezone = ''Eastern Time (US & Canada)'' > > > If am wrong please clarify. > > Thank You! > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/m4Yr5fIi9CYJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Feb 7, 2013 at 3:41 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 7 February 2013 05:54, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Read. http://guides.rubyonrails.org/i18n.html > > If that does not help then tell us what you mean by it not working.To add: Just to make things clear if this is you. If you are thinking that Rails will store the data inside of the db as your timezone it won''t. Rails stores all times as UTC so they can be converted easily no matter the system, the timezones only apply to the final object created. You can also try just setting the city name ("New York") and see if that works though Eastern should work. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
1.9.3-p286 :001 > Time.zone.now => Thu, 07 Feb 2013 06:34:49 UTC +00:00 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' => "Eastern Time (US & Canada)" 1.9.3-p286 :003 > Time.zone.now => Thu, 07 Feb 2013 01:35:00 EST -05:00 Above is working well. Case 1: But i need to store each records in database with that time stamp. i.e created_at and updated_at need to be EST, not in UTC. Case 2: Also I need store all records created_at and updated_at with client country time, if one client in NewYork, need to store their time and other person in India, their time need to store. Thank You! On Thu, Feb 7, 2013 at 3:19 PM, Jordon Bedwell <envygeeks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Feb 7, 2013 at 3:41 AM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > On 7 February 2013 05:54, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > >> Read. http://guides.rubyonrails.org/i18n.html > > > > If that does not help then tell us what you mean by it not working. > > To add: Just to make things clear if this is you. If you are thinking > that Rails will store the data inside of the db as your timezone it > won''t. Rails stores all times as UTC so they can be converted easily > no matter the system, the timezones only apply to the final object > created. You can also try just setting the city name ("New York") and > see if that works though Eastern should work. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- Regards by Saravanan.P -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 7 February 2013 10:10, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote:> 1.9.3-p286 :001 > Time.zone.now > => Thu, 07 Feb 2013 06:34:49 UTC +00:00 > 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' > => "Eastern Time (US & Canada)" > 1.9.3-p286 :003 > Time.zone.now > => Thu, 07 Feb 2013 01:35:00 EST -05:00 > > > Above is working well. > Case 1: > But i need to store each records in database with that time stamp. i.e > created_at and updated_at need to be EST, not in UTC.Why? Don''t do it, always store it in UTC.> > Case 2: > Also I need store all records created_at and updated_at with client > country time, if one client in NewYork, need to store their time and other > person in India, their time need to store.Again why would you need to do that? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Because my application will use in several country so I need to know what time they are creating records. On Thu, Feb 7, 2013 at 3:45 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 7 February 2013 10:10, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote: > > 1.9.3-p286 :001 > Time.zone.now > > => Thu, 07 Feb 2013 06:34:49 UTC +00:00 > > 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' > > => "Eastern Time (US & Canada)" > > 1.9.3-p286 :003 > Time.zone.now > > => Thu, 07 Feb 2013 01:35:00 EST -05:00 > > > > > > Above is working well. > > Case 1: > > But i need to store each records in database with that time stamp. > i.e > > created_at and updated_at need to be EST, not in UTC. > > Why? Don''t do it, always store it in UTC. > > > > > Case 2: > > Also I need store all records created_at and updated_at with client > > country time, if one client in NewYork, need to store their time and > other > > person in India, their time need to store. > > Again why would you need to do that? > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- Regards by Saravanan.P -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 7 February 2013 10:25, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote: Please don''t top post, it makes it difficult to follow the thread. Insert your reply at appropriate points in previous message. Thanks.> Because my application will use in several country so I need to know what > time they are creating records.You will know the time (in UTC). If you store updated_at, for example, in the local timezone and you have one record with an update_at of 12:00 and another 13:00 (for a different user) then you would not know which came first. If they are all in UTC then you know the exact time it actually happened. Colin> > > On Thu, Feb 7, 2013 at 3:45 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 7 February 2013 10:10, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote: >> > 1.9.3-p286 :001 > Time.zone.now >> > => Thu, 07 Feb 2013 06:34:49 UTC +00:00 >> > 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' >> > => "Eastern Time (US & Canada)" >> > 1.9.3-p286 :003 > Time.zone.now >> > => Thu, 07 Feb 2013 01:35:00 EST -05:00 >> > >> > >> > Above is working well. >> > Case 1: >> > But i need to store each records in database with that time stamp. >> > i.e >> > created_at and updated_at need to be EST, not in UTC. >> >> Why? Don''t do it, always store it in UTC. >> >> > >> > Case 2: >> > Also I need store all records created_at and updated_at with client >> > country time, if one client in NewYork, need to store their time and >> > other >> > person in India, their time need to store. >> >> Again why would you need to do that? >> >> Colin >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > > -- > Regards by > Saravanan.P > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
http://railscasts.com/episodes/106-time-zones-in-rails-2-1 http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails On Thu, Feb 7, 2013 at 4:07 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 7 February 2013 10:25, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote: > > Please don''t top post, it makes it difficult to follow the thread. > Insert your reply at appropriate points in previous message. Thanks. > > > Because my application will use in several country so I need to know what > > time they are creating records. > > You will know the time (in UTC). If you store updated_at, for > example, in the local timezone and you have one record with an > update_at of 12:00 and another 13:00 (for a different user) then you > would not know which came first. If they are all in UTC then you know > the exact time it actually happened. > > Colin > > > > > > > On Thu, Feb 7, 2013 at 3:45 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> > >> On 7 February 2013 10:10, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> > wrote: > >> > 1.9.3-p286 :001 > Time.zone.now > >> > => Thu, 07 Feb 2013 06:34:49 UTC +00:00 > >> > 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' > >> > => "Eastern Time (US & Canada)" > >> > 1.9.3-p286 :003 > Time.zone.now > >> > => Thu, 07 Feb 2013 01:35:00 EST -05:00 > >> > > >> > > >> > Above is working well. > >> > Case 1: > >> > But i need to store each records in database with that time stamp. > >> > i.e > >> > created_at and updated_at need to be EST, not in UTC. > >> > >> Why? Don''t do it, always store it in UTC. > >> > >> > > >> > Case 2: > >> > Also I need store all records created_at and updated_at with > client > >> > country time, if one client in NewYork, need to store their time and > >> > other > >> > person in India, their time need to store. > >> > >> Again why would you need to do that? > >> > >> Colin > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "Ruby on Rails: Talk" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> For more options, visit https://groups.google.com/groups/opt_out. > >> > >> > > > > > > > > -- > > Regards by > > Saravanan.P > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
> You will know the time (in UTC). If you store updated_at, for > example, in the local timezone and you have one record with an > update_at of 12:00 and another 13:00 (for a different user) then you > would not know which came first. If they are all in UTC then you know > the exact time it actually happened.Yes Colin you are correct. I have to try using UTC time to show customer their times. i.e Their recored created time. and> http://railscasts.com/episodes/106-time-zones-in-rails-2-1 > http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails > http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-railsThanks for the reply On Thu, Feb 7, 2013 at 4:09 PM, rajeevsharma86 <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> http://railscasts.com/episodes/106-time-zones-in-rails-2-1 > > > http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails > > > http://www.elabs.se/blog/36-working-with-time-zones-in-ruby-on-rails > > > On Thu, Feb 7, 2013 at 4:07 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 7 February 2013 10:25, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote: >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your reply at appropriate points in previous message. Thanks. >> >> > Because my application will use in several country so I need to know >> what >> > time they are creating records. >> >> You will know the time (in UTC). If you store updated_at, for >> example, in the local timezone and you have one record with an >> update_at of 12:00 and another 13:00 (for a different user) then you >> would not know which came first. If they are all in UTC then you know >> the exact time it actually happened. >> >> Colin >> >> > >> > >> > On Thu, Feb 7, 2013 at 3:45 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >> wrote: >> >> >> >> On 7 February 2013 10:10, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> >> wrote: >> >> > 1.9.3-p286 :001 > Time.zone.now >> >> > => Thu, 07 Feb 2013 06:34:49 UTC +00:00 >> >> > 1.9.3-p286 :002 > Time.zone = ''Eastern Time (US & Canada)'' >> >> > => "Eastern Time (US & Canada)" >> >> > 1.9.3-p286 :003 > Time.zone.now >> >> > => Thu, 07 Feb 2013 01:35:00 EST -05:00 >> >> > >> >> > >> >> > Above is working well. >> >> > Case 1: >> >> > But i need to store each records in database with that time >> stamp. >> >> > i.e >> >> > created_at and updated_at need to be EST, not in UTC. >> >> >> >> Why? Don''t do it, always store it in UTC. >> >> >> >> > >> >> > Case 2: >> >> > Also I need store all records created_at and updated_at with >> client >> >> > country time, if one client in NewYork, need to store their time and >> >> > other >> >> > person in India, their time need to store. >> >> >> >> Again why would you need to do that? >> >> >> >> Colin >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Ruby on Rails: Talk" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> an >> >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> . >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> > >> > >> > >> > -- >> > Regards by >> > Saravanan.P >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Ruby on Rails: Talk" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > -- > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- Regards by Saravanan.P -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Feb 7, 2013 at 4:54 AM, Saravanan P <saravanan.p-tks5Z7IV8F8RmelmmXo44Q@public.gmane.org> wrote:>> You will know the time (in UTC). If you store updated_at, for >> example, in the local timezone and you have one record with an >> update_at of 12:00 and another 13:00 (for a different user) then you >> would not know which came first. If they are all in UTC then you know >> the exact time it actually happened. > > Yes Colin you are correct. I have to try using UTC time to show customer > their times. i.e Their recored created time.Store their timezone as an extra field they themselves can set. # Time.now.in_time_zone(Time.find_zone(-7)) # User.first.created_at.in_time_zone(Time.find_zone(-7)) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.