Ruby on Rails
Friday, April 4, 2014
On Friday, April 4, 2014 2:37:28 AM UTC-4, Ruby-Forum.com User wrote:
Hello,
How to convert utc time to a time in a particular time zone. As I
need to display local time of timezone(-05:00).
Thank you,
Praveen
--
Posted via http://www.ruby-forum.com/.
use the ruby method local time. in my example, i have an object post with an attribute created_at that is a date/time. You display this in local time with formatting as follows:
<%= post.created_at.localtime.strftime("%-m/%-d/%Y at %-I:%M %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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fcf8e49c-3f46-4246-bd9b-bcb021500b26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment