×

Post Details


I want to put the difference of time between my updated_at column (in database using timestamp) and now. I want it to be human-friendly like so : 53 mins ago, 2 hours ago, 3 days ago, etc.

Is there any function out there that I could use to make it easier?

To be sure that you understand me, let's say I have in my database a column updated_at which is equal to 2015-06-22 20:00:03. It is now 20:00:28 so in my webpage I'd like to see : 25 mins ago. When it's higher than 59 minutes, I want to show only hours and when it's higher than 24 hours I'd like to see how many days ago.