I'm new to Ruby/Rails and trying to understand Time/Date/DateTime. I
came across this weirdness while playing around and was wondering if
someone can tell me what is going on here:

>> w = Work.find(9)
=> #<Work id: 9, [...] created_at: "2009-04-06 16:29:43" [...]>
>> w.created_at.class
=> ActiveSupport::TimeWithZone
>> w.created_at
=> Mon, 06 Apr 2009 16:29:43 UTC +00:00
>> w.created_at.getutc
=> Mon Apr 06 16:29:43 UTC 2009
>> w.created_at
=> Mon, 06 Apr 2009 16:29:43 UTC +00:00
>> w.created_at.localtime
=> Mon Apr 06 10:29:43 -0600 2009
>> w.created_at
=> Mon, 06 Apr 2009 16:29:43 UTC +00:00

OK, all good so far.

>> w.created_at.getutc.localtime
=> Mon Apr 06 10:29:43 -0600 2009
>> w.created_at
=> Mon, 06 Apr 2009 10:29:43 UTC +00:00

WTF, why did this change the value of w.created_at? As far as I can tell
from the documentation there shouldn't be any side effects from these
calls.

Thanks for any clarification, C
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to