Date preview like facebook time ago using PHP
What is time ago?
Time Ago functionality is used to display time in a different format, so that we can:
- Display the time format, which is easy to understand.
- Display the time format similar to different time zone.
- Show time interactively in messaging and feeds.
We can do it easily by a php function. In this function we will calculate time using particular country
timezone. If you have previous date and time then in this function it
count time difference between current date and time with previous date on
simple php logic. We will convert the difference in time stamp and get number of seconds between these date and time.
From seconds we can easily get minutes, hours, days, weeks, months and
years.
Time ago function implementation:
Leave your Comment