PHP function to display time ago base on timestamp

Timestamp in PHP only for system usage, for user we have to show it in easy to read way like: 1 minutes ago, 1 hour ago … Today I will show you to use PHP function to display time ago base on timestamp.

php function time agoHere is very simple PHP function what you can use in any PHP project to display time.

Now, time to show and use it ‘s quite simple like this

You will see the output like this

 

 

2 comments

  1. It work nice for me. But I want something a little different. Just look like this in output
    “about 1 hour ago”
    How can I customize your function?

  2. This is really helpful function, thanks to share with us 🙂
    I also recently wrote another PHP time ago function, where i fixed 1 minutes issue into minute hope this also help.
    https://htmlcssphptutorial.wordpress.com/2015/08/21/time-ago-php-function/

Leave a Reply

Your email address will not be published. Required fields are marked *

*

CDN by MaxCDN