# Wierdness with time.getutc.localtime

**URL:** <https://www.ruby-forum.com/t/wierdness-with-time-getutc-localtime/164862>\
**Category:** Rails\
**Created:** [April 6, 2009, 8:02pm UTC](https://www.ruby-forum.com/t/wierdness-with-time-getutc-localtime/164862 "2009-04-06T20:02:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cookiemonster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a4c791/32.png) [@cookiemonster](https://www.ruby-forum.com/u/cookiemonster)\
**Post date:** [April 6, 2009, 8:02pm UTC](https://www.ruby-forum.com/t/wierdness-with-time-getutc-localtime/164862/1 "2009-04-06T20:02:28Z")

</div>

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
