On 14 December 2010 13:46, pepe <Pepe@betterrpg.com> wrote:
>
>> So there is never any ambiguity about timestamps in the database. For
>> example, suppose you move to a server in another timezone, it can get
>> very messy if you have timestamps in EST or whatever happens to be
>> your local timezone today. By keeping all timestamps in the db in UTC
>> you will always know what they mean.
>
> I understand the benefits of UTC, however...
>
>> Normally Rails will do the
>> conversion to local time for you so the fact that it is UTC in the db
>> is not something you need normally worry about.
>
> This is the reason why I noticed. I have to display on screen the date
> and time from updated_at and I saw that while my local time was around
> 4:00 PM the screen was displaying around 9:00 PM. In other words,
> there is no 'conversion' going on. I don't know if it makes a
> difference but when I display the values I am not displaying the full
> value of updated_at, I have to break it down in 2 values, date and
> time, and I am using strftime to do the job. Should I be using
> something different and/or converting the values to local time first
> somehow?
Use created_at.localtime.strftime( .... )
Colin
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment