# Rails 3 timezone error

**URL:** <https://www.ruby-forum.com/t/rails-3-timezone-error/189419>\
**Category:** Rails\
**Created:** [May 31, 2010, 5:44pm UTC](https://www.ruby-forum.com/t/rails-3-timezone-error/189419 "2010-05-31T17:44:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSchwindt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eb9ed0/32.png) [@JSchwindt](https://www.ruby-forum.com/u/JSchwindt)\
**Post date:** [May 31, 2010, 5:44pm UTC](https://www.ruby-forum.com/t/rails-3-timezone-error/189419/1 "2010-05-31T17:44:57Z")

</div>

I am struggling with time zone support in Rails 3 beta and I would  
like to know if it is a bug or if I am doing something wrong. He is  
the problem:

> Time.zone = ‘Madrid’ # it is GMT+2  
> =\> “Madrid”  
> c = Comment.new  
> =\> #\<Comment id: nil, title: “”, pub\_at: nil\>  
> c.pub\_at = Time.zone.parse(‘10:00:00’)  
> =\> Mon, 31 May 2010 10:00:00 CEST +02:00  
> c.save  
> c  
> =\> #\<Comment id: 3, title: “”, pub\_at: “2010-05-31 08:00:00”\>  
> c.reload  
> =\> #\<Comment id: 3, title: “”, pub\_at: “2010-05-31 08:00:00”\>  
> ruby-1.8.7-p249 \> c.pub\_at  
> =\> Mon, 31 May 2010 13:00:00 CEST +02:00

As you can see, the pub\_at attribute is stored correctly in the  
database but when it is retrieved it adds 3 hours and I suspect that  
it is because it is using my local machine timezone that is in GMT-3.

The same sequence of commands in rails 2.3.5 works perfectly.

Any toughts? Should I report a ticket?
