开发者

How to get datetime in words like "today", "yesterday" or "25 minutes ago"? [duplicate]

开发者 https://www.devze.com 2023-04-04 03:41 出处:网络
This question already has answers here: Closed 11 years 开发者_如何学编程ago. Possible Duplicate:
This question already has answers here: Closed 11 years 开发者_如何学编程ago.

Possible Duplicate:

How do I calculate relative time?

How to display “12 minutes ago” etc in a PHP webpage?

I have date formats like this:

2011-09-10 12:00:00
2011-09-12 11:02:05
2011-09-12

I want to create a function that will get a date and will output something like this ?

5 minutes ago
2 hours ago
today
yesterday

and show date if date is far away.

Is there any related function in php or any free already written library.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号