Topic: Displaying a DATETIME field as "5 minutes ago" or "3 hours ago" etc...

For my objects that have a DATETIME value in their DB table representing when they were created, i'd like to print out (for example) "20 minutes ago" instead of (for example) Tue Jul 17 13:48:00 +0100 2007.

Does anyone know how to do this?  Can you

###########################################
#If i've helped you then please recommend me at Working With Rails:
#http://www.workingwithrails.com/person/ … i-williams

Re: Displaying a DATETIME field as "5 minutes ago" or "3 hours ago" etc...

Try time_ago_in_words:

<%= time_ago_in_words(@time) %>

Alex

Re: Displaying a DATETIME field as "5 minutes ago" or "3 hours ago" etc...

alexpt wrote:

Try time_ago_in_words:

<%= time_ago_in_words(@time) %>

Alex

That's great, thanks a lot!

###########################################
#If i've helped you then please recommend me at Working With Rails:
#http://www.workingwithrails.com/person/ … i-williams