将我的日期转换为小时和天数[重复]

This question already has an answer here:

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)

</div>

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.