Search code examples
ruby-on-railsrubytimestamprhtml

Timestamp in rhtml


I'm trying to show timestamp on .rhtml page, but it returns something like this:

Mon Dec 09 21:03:22 +0400 2013

How it should be:

2013.12.09 21:03:22

What's wrong? This is how I do:

<%= message.time %>

Solution

  • Use strftime

    message.time.strftime("%Y.%m.%d %H:%M:%S")