Formatting a unix timestamp

I have a database with unix timestamps in it (saved as varchar)…

Right now I’m using the following to format it (item table, created_at
field)…:

Time.at(item.created_at.to_i).strftime("%Y-%m-%d %H:%M:%S")

I was wondering if it’s the most effective way to do it? Or if there is
a quicker way?

On 23 Sep 2007, at 22:47, Jean-nicolas Jolivet wrote:

a quicker way?
item.create_at.to_formatted_s(:db)

Same can be done with dates.

Best regards

Peter De Berdt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs