PHP Time Ago Function

Time Ago Function is a function that is commonly used to display time in human understandable format, as you have seen many times on social networks, whenever you post any status on your Facebook, Twitter or any other network, it says posted few seconds ago, 1 min ago, 1 hour age, etc. This is actually done by subtracting the post published time from the current time.

For this purpose we need to store a date in database, date should be in MySQL standard date and time format (“Y-m-d H:i:s”).

12 Comments