-3

Hi i need covert date to hours and days

My date format is like this : 2013-09-01 22:15:59

I need to show like this within 24 hours (hours) :(12 hours back)

I need to show like this after 24 hours (days) :(5 days back)

gowtham4chat
  • 31
  • 1
  • 6
  • possible duplicate of [Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago...](http://stackoverflow.com/a/18602474/67332) – Glavić Oct 02 '13 at 12:06

1 Answers1

2

Use example :

echo time_elapsed_string('2013-05-01 00:22:35');
echo time_elapsed_string('2013-05-01 00:22:35', true);

Output :

4 months ago
4 months, 2 weeks, 3 days, 1 hour, 49 minutes, 15 seconds ago

Link to the function.

Community
  • 1
  • 1
Glavić
  • 42,781
  • 13
  • 77
  • 107